Input
Used to enter multiple lines of text.
import { Input } from '@fidely-ui/react'
export const InputBasics = () => {
return <Input placeholder="Enter your name" />
}
Usage
import { Input } from '@fidely-ui/react'<Input placeholder="..." />Examples
Sizes
Pass the size prop to change the size of the input.
import { Input, Stack } from '@fidely-ui/react'
export const InputSizes = () => {
const sizes = ['xs', 'sm', 'md', 'lg', 'xl'] as const
return (
<Stack gap={2}>
{sizes.map((size) => (
<Input placeholder="Enter email address..." size={size} key={size} />
))}
</Stack>
)
}
Variants
Pass the variant prop to change the appearance of the input.
import { Input, Stack } from '@fidely-ui/react'
export const InputVariants = () => {
const variants = ['subtle', 'flushed', 'outline'] as const
return (
<Stack gap={2}>
{variants.map((variant) => (
<Input placeholder="Enter email..." variant={variant} key={variant} />
))}
</Stack>
)
}
Helper Text
Pair the input with the Field component to add helper text.
Additional text.
import { Field, Input } from '@fidely-ui/react'
export const InputHelperText = () => {
return (
<Field.Root required>
<Field.Label>
Comment <Field.RequiredIndicator />
</Field.Label>
<Input placeholder="Start typing..." variant="subtle" />
<Field.HelperText>Additional text.</Field.HelperText>
</Field.Root>
)
}
Error Text
Pair the input with the Field component to add error text.
Field is required
import { Field, Input } from '@fidely-ui/react'
export const InputErrorText = () => {
return (
<Field.Root invalid>
<Field.Label>
Comment <Field.RequiredIndicator />
</Field.Label>
<Input placeholder="Start typing..." variant="subtle" />
<Field.Error>Field is required</Field.Error>
</Field.Root>
)
}
Disabled
Use the disabled prop to disable the input.
import { Input } from '@fidely-ui/react'
export const InputDisabled = () => {
return <Input disabled placeholder="disabled input" />
}
Placeholder Style
Use the _placeholder prop to style the placeholder text.
import { Input } from '@fidely-ui/react'
export const InputPlaceholder = () => {
return (
<Input
color="orange.9"
placeholder="custom placeholder"
_placeholder={{ color: 'inherit' }}
/>
)
}