TextField
TextField displays a field that handles toggling between multiple values.Import
import { TextField } from "@prismane/core";
Usage
function Demo() { const [value, setValue] = useState(""); const handleChange = (e) => setValue(e.target.value); return ( <TextField value={value} onChange={handleChange} placeholder="Enter Text" /> ); }
With Icon
function Demo() { const [value, setValue] = useState(""); return ( <TextField placeholder="Enter Text" value={value} onChange={(e) => setValue(e.target.value)} icon={<EnvelopeSimple />} /> ); }
TextField Variants
function Demo() { const [value, setValue] = useState(""); return ( <> <TextField variant="outlined" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> <TextField variant="filled" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> <TextField variant="underlined" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> <TextField variant="unstyled" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> </> ); }
TextField Sizes
function Demo() { const [value, setValue] = useState(""); return ( <Flex direction="column" gap={fr(2)}> <TextField size="xs" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> <TextField size="sm" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> <TextField size="base" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> <TextField size="md" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> <TextField size="lg" placeholder="Default Field" label="Default Field:" value={value} onChange={(e) => setValue(e.target.value)} /> </Flex> ); }
API
Please refer to the documentation below for a comprehensive overview of all the available props and classes for the mentioned components.