Text Field

Default

label and placeholder are the minimum needed for a usable field. FieldLabel and FieldMessage are shared with NumberField and TextArea; see the Field page for validation tones, disabled state, and spacing.

<Stack space="large">
<TextField
id="tf-a"
label="Label"
placeholder="Placeholder"
/>
<TextField
id="tf-b"
label="Label"
value="Value"
/>
</Stack>

Full form example

All features combined.

Get in touch

I'll reply to this address.

What would you like to talk about?

<Box
background="surface"
padding="large"
borderRadius="md"
boxShadow="borderNeutralLight">
<Stack space="large">
<Heading level="3">Get in touch</Heading>
<Tiles
columns={{ mobile: 1, tablet: 2 }}
space="large">
<TextField
id="form-firstname"
label="First name"
secondaryLabel="Required"
placeholder="Lloyd"
/>
<TextField
id="form-lastname"
label="Last name"
secondaryLabel="Required"
placeholder="Atkinson"
/>
</Tiles>
<TextField
id="form-email"
type="email"
label="Email"
secondaryLabel="Required"
description="I'll reply to this address."
placeholder="you@example.com"
/>
<TextArea
id="form-message"
label="Message"
secondaryLabel="Required"
description="What would you like to talk about?"
rows={5}
placeholder="Tell me what's on your mind..."
/>
<Inline space="small">
<Button tone="brand">Send message</Button>
<Button
variant="soft"
tone="neutral">
Cancel
</Button>
</Inline>
</Stack>
</Box>