[ui][text input] add description prop

This commit is contained in:
Yangshun Tay
2022-10-29 18:21:59 +08:00
parent 2e37e90cc8
commit 4d280f0846
2 changed files with 36 additions and 5 deletions

View File

@ -12,6 +12,9 @@ export default {
autoComplete: {
control: 'text',
},
description: {
control: 'text',
},
disabled: {
control: 'boolean',
},
@ -183,6 +186,25 @@ export function Error() {
);
}
export function Description() {
const [value, setValue] = useState('1234567');
return (
<TextInput
description="Select a password that is at least 6 characters"
errorMessage={
value.length < 6 ? 'Password must be at least 6 characters' : undefined
}
label="Password"
startAddOn={KeyIcon}
startAddOnType="icon"
type="password"
value={value}
onChange={setValue}
/>
);
}
export function AddOns() {
return (
<div className="space-y-4">