File: text-field.md | Updated: 11/15/2025
ThemesThemes PrimitivesPrimitives IconsIcons ColorsColors
Getting started Styling Layout Releases Resources
Overview Color Dark mode Typography Spacing Breakpoints Radius Shadows Cursors
Box Flex Grid Container Section
Text Heading Blockquote Code Em Kbd Link Quote Strong
Alert Dialog Aspect Ratio Avatar Badge Button Callout Card Checkbox Checkbox Group Checkbox Cards Context Menu Data List Dialog Dropdown Menu Hover Card Icon Button Inset Popover Progress Radio Radio Group Radio Cards Scroll Area Segmented Control Select Separator Skeleton Slider Spinner Switch Table Tabs Tab Nav Text Area Text Field Tooltip
Accessible Icon Portal Reset Slot Theme Visually Hidden
Components
Captures user input with an optional slot for buttons and icons.
View source Report an issue View in Playground
<TextField.Root placeholder="Search the docsā¦">
<TextField.Slot>
<MagnifyingGlassIcon height="16" width="16" />
</TextField.Slot>
</TextField.Root>
Groups Slot and Input parts. This component is based on the div element and supports common margin props
.
| Prop | Type | Default |
| --- | --- | --- |
| size | Responsive<"1" \| "2" \| "3"> | "2" |
| variant<br><br>Prop description | "classic" \| "surface" \| "soft" | "surface" |
| color<br><br>Prop description | enum<br><br>See full type | No default value |
| radius<br><br>Prop description | "none" \| "small" \| "medium" \| "large" \| "full" | No default value |
Contains icons or buttons associated with an Input.
| Prop | Type | Default |
| --- | --- | --- |
| side | "left" \| "right" | No default value |
| color<br><br>Prop description | enum<br><br>See full type | No default value |
| gap | Responsive<enum \| string><br><br>See full type | No default value |
| px | Responsive<enum \| string><br><br>See full type | No default value |
| pl | Responsive<enum \| string><br><br>See full type | No default value |
| pr | Responsive<enum \| string><br><br>See full type | No default value |
Use the size prop to control the size.
<Flex direction="column" gap="3">
<Box maxWidth="200px">
<TextField.Root size="1" placeholder="Search the docsā¦" />
</Box>
<Box maxWidth="250px">
<TextField.Root size="2" placeholder="Search the docsā¦" />
</Box>
<Box maxWidth="300px">
<TextField.Root size="3" placeholder="Search the docsā¦" />
</Box>
</Flex>
Use matching component sizes when composing Text Field with buttons. However, donāt use size 1 inputs with buttonsāat this size, there is not enough vertical space to nest other interactive elements.
<Flex direction="column" gap="3" maxWidth="400px">
<Box maxWidth="200px">
<TextField.Root placeholder="Search the docsā¦" size="1">
<TextField.Slot>
<MagnifyingGlassIcon height="16" width="16" />
</TextField.Slot>
</TextField.Root>
</Box>
<Box maxWidth="250px">
<TextField.Root placeholder="Search the docsā¦" size="2">
<TextField.Slot>
<MagnifyingGlassIcon height="16" width="16" />
</TextField.Slot>
<TextField.Slot>
<IconButton size="1" variant="ghost">
<DotsHorizontalIcon height="14" width="14" />
</IconButton>
</TextField.Slot>
</TextField.Root>
</Box>
<Box maxWidth="300px">
<TextField.Root placeholder="Search the docsā¦" size="3">
<TextField.Slot>
<MagnifyingGlassIcon height="16" width="16" />
</TextField.Slot>
<TextField.Slot pr="3">
<IconButton size="2" variant="ghost">
<DotsHorizontalIcon height="16" width="16" />
</IconButton>
</TextField.Slot>
</TextField.Root>
</Box>
</Flex>
Use the variant prop to control the visual style.
<Flex direction="column" gap="3" maxWidth="250px">
<TextField.Root variant="surface" placeholder="Search the docsā¦" />
<TextField.Root variant="classic" placeholder="Search the docsā¦" />
<TextField.Root variant="soft" placeholder="Search the docsā¦" />
</Flex>
Use the color prop to assign a specific color
.
<Flex direction="column" gap="3" maxWidth="250px">
<TextField.Root
color="indigo"
variant="soft"
placeholder="Search the docsā¦"
/>
<TextField.Root color="green" variant="soft" placeholder="Search the docsā¦" />
<TextField.Root color="red" variant="soft" placeholder="Search the docsā¦" />
</Flex>
Use the radius prop to assign a specific radius value.
<Flex direction="column" gap="3" maxWidth="250px">
<TextField.Root radius="none" placeholder="Search the docsā¦" />
<TextField.Root radius="large" placeholder="Search the docsā¦" />
<TextField.Root radius="full" placeholder="Search the docsā¦" />
</Flex>
PreviousText Area
NextTooltip