[feat] New Component: Input prefix or suffix
See original GitHub issueInput prefix or suffix
USWDS Version
Description
Use input prefixes and suffixes to show symbols or abbreviations that help users enter the right type of information in a form’s text input.
Requirements (proposed)
Prop Interface
interface InputPrefixSuffixProps = {
type: ‘prefix’ | ‘suffix’
className?: string
children: React.ReactNode
} & JSX.IntrinsicElements['div']
Example Implementation (proposed)
return (
<FormGroup>
<label class="usa-label" for="example-input-prefix">Credit card number</label>
<InputPrefixSuffix type="prefix">
<Icon name="credit_card"/>
</InputPrefixSuffix>
</FormGroup>
<FormGroup error={true}>
<label class="usa-label" for="example-input-prefix-error">Credit card number (Error)</label>
<InputPrefixSuffix type="prefix">
<Icon name="credit_card"/>
</InputPrefixSuffix>
</FormGroup>
<FormGroup>
<label class="usa-label" for="example-input-suffix">Weight, in pounds</label>
<InputPrefixSuffix type="suffix">
lbs.
</InputPrefixSuffix>
</FormGroup>
)
More Details
<div>
root element
Other Considerations
Issue Analytics
- State:
- Created 2 years ago
- Comments:14 (7 by maintainers)
Top Results From Across the Web
Input prefix or suffix | U.S. Web Design System (USWDS)
Use input prefixes and suffixes to show symbols or abbreviations that help users enter the right type of information in a form's text...
Read more >o-forms README - Origami Registry
Checkboxes & Radios; Prefix, Suffix; Toggles; Wrappers and Messages; Other changes ... More text input examples are available on the Origami Registry.
Read more >Basics - styled-components
Styled components uses stylis.js package under the hood for prefixing the css rules. For additional information about the supported prefixes in stylis.js visit ......
Read more >Angular PrimeNG Form InputNumber Prefix and Suffix ...
In this article, we will learn how to use the Form InputNumber Prefix and Suffix Component in Angular PrimeNG. We will also learn...
Read more >spaCy 101: Everything you need to know
Whether you're new to spaCy, or just want to brush up on some NLP basics and implementation details – this ... Can a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
👋 Hey there, I’m an engineer currently consulting in uk gov, are you still looking for contributors for this? Happy to look into it 🤓
@SirenaBorracha - I think for your proposed prop interface you meant to use
type
instead ofinterface
. Using interface with& JSX.xx
will give you this namespace error TS2708: Cannot use namespace ‘JSX’ as a value.I’d also suggest two components here, but happy to concede (since we don’t have this component ourselves so I’m not sure how your developers would rather use this component), I’d have one component for
InputPrefix
and one forInputSuffix
, and remove the need fortype: ‘prefix’ | ‘suffix’
Is InputPrefix|Suffix only applicable to textInputs? Could I suggest an API similar to this? https://github.com/NHSDigital/nhsuk-react-components/tree/main/src/components/error-summary
so in this case the implementation would be
@brandonlenz circleCI says no 🚫 - I also don’t have write access so it wont let me push any commits up either