Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Design: Add feature to add prefix or suffix label to input component. #838

Open
adorayi opened this issue Apr 16, 2024 · 1 comment
Open
Labels

Comments

@adorayi
Copy link
Contributor

adorayi commented Apr 16, 2024

Given the input component is to be used in a context that requires a prefix or suffix, such as cost with currency, or measurements
When a designer or developer wishes to add a prefix or suffix
Then they have an option to do so in design and in code

@adorayi
Copy link
Contributor Author

adorayi commented Apr 16, 2024

cds-snc/gcds-components#502

Describe the feature request.
We would like to be able to put explanatory text directly before or after an input or select within gcds components.

Describe the use case.
Enter the last three digits of your SIN:
XXX-XXX-[ ]

image

Describe the preferred solution.
We think this would be best implemented by exposing slots for before-elements or after-elements. Another idea might be exposing an interior template that could be modified by developers.

Describe all alternatives.
We can place the explanatory text after the entire gcds-input, but our designers won't like this as much.
We can put the gcds-input inside a wrapper with display:inline-block and put the explanatory text to the right side, but if there is an error message then the width of the gcds-input and its label, etc will be restricted. This wouldn't work at all for explanatory text to the left.
We can create separate components for label and error, but then we have to manually manage the DOM representing the error, as well as the error state on the input/select.

@adorayi adorayi added the design label Apr 16, 2024
@adorayi adorayi changed the title Add feature to add prefix or suffix label to input component. Design: Add feature to add prefix or suffix label to input component. Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant