Input
Used to retrieve user input.
Props
type
string
The type of inputplaceholder
string
The placeholder textlabel
string
Label above the inputcaption
string
Instructions on how to use the fielderror
string
Error message, replaces captiondisabled
boolean
Whether the input is disabledsize
"small" | "medium"
The size of the inputvalue
string
The value of the inputonChange
function
The function to call when the input changesimport * as React from "react";
import { Input } from "basics";
export default () => {
return (
<Input
type="password"
placeholder="Enter your password"
label="Password"
caption="Between 12-24 characters"
size="medium"
value="1234567"
/>
);
}
Error
<Input
type="password"
value="12345678"
placeholder="Enter your password"
label="Password"
error="Password is too short"
/>
Disabled
<Input type="password" value="12345678" label="Password" disabled />
Prefix
<Input prefix={<SearchIcon />} placeholder="Search..." />
Suffix
<Input suffix={<Kbd style={{ marginRight: 16 }}>Esc</Kbd>} placeholder="Search..." />
Loading
The loading state will replace the suffix
with a spinner.
The input will also be disabled.
<Input prefix={<SearchIcon />} placeholder="Search..." loading />
Sizes
<Flex align="center" gap="16">
<Input placeholder="Search..." />
<Input size="small" placeholder="Search..." />
</Flex>