Skip to main content
Parsley Design Systems logoParsley Design System - sample

Text Input

Examples

Default

Code

1<TextInput id="test-control-1" label="Test label" width="l" onChange={() => {}} />

With value set

Code

1<TextInput
2 id="test-control-2"
3 label="Test label" width="l" onChange={() => {}}
4 value="Test value"
5/>

With support text

This is support text

Code

1<TextInput
2 label="Test label" width="l" onChange={() => {}}
3 supportText="This is support text"
4/>

With field declaration

Code

1<TextInput
2 id="test-control-4r"
3 label="Test label" width="l" onChange={() => {}}
4 declaration="required"
5/>
6
7<TextInput
8 id="test-control-4o"
9 label="Test label" width="l" onChange={() => {}}
10 required={false}
11 declaration="optional"
12/>

With a different form control size applied

Code

1<TextInput id="test-control-5-s" label="Test label" width="l" onChange={() => {}} size="small" value="Test value" />
2<TextInput id="test-control-5-d" label="Test label" width="l" onChange={() => {}} value="Test value" />
3<TextInput id="test-control-5-l" label="Test label" width="l" onChange={() => {}} size="large" value="Test value" />

With a different label size applied

Code

1<TextInput id="test-control-6-s" label="Test label" width="l" onChange={() => {}} labelSize="small" value="Test value" />
2<TextInput id="test-control-6-d" label="Test label" width="l" onChange={() => {}} labelSize="default" value="Test value" />
3<TextInput id="test-control-6-l" label="Test label" width="l" onChange={() => {}} labelSize="large" value="Test value" />

With label element hidden

Code

1<TextInput
2 id="test-control-7"
3 label="Test label" width="l" onChange={() => {}}
4 labelHidden
5/>

With label context applied

Code

1<TextInput
2 id="test-control-8"
3 label="Test label" width="l" onChange={() => {}}
4 labelContext="When typing a suggested list of options will appear, use arrow keys to operate"
5/>

With a specific width set

Code

1<TextInput id="test-control-9-xxs" label="Title" onChange={() => {}} width="xxs" value="Mr" />
2<TextInput id="test-control-9-xs" label="Days" onChange={() => {}} width="xs" value="23" />
3<TextInput id="test-control-9-s" label="Test label" onChange={() => {}} width="s" value="Test value" />
4<TextInput id="test-control-9-m" label="Test label" onChange={() => {}} width="m" value="Test value" />
5<TextInput id="test-control-9-l" label="Test label" onChange={() => {}} width="l" value="Test value" />
6<TextInput id="test-control-9-xl" label="Test label" onChange={() => {}} width="xl" value="Test value" />
7<TextInput id="test-control-9-xxl" label="Test label" onChange={() => {}} width="xxl" value="Test value" />
8<TextInput id="test-control-9-full" label="Test label" onChange={() => {}} width="full" value="Test value" />

With error validation

This is error text

Code

1<TextInput
2 id="test-control-10"
3 label="Test label" width="l" onChange={() => {}}
4 error
5 errorText="This is error text"
6 value="Test value"
7/>

As a disabled form control

Code

1<TextInput
2 id="test-control-11"
3 label="Test label" width="l" onChange={() => {}}
4 disabled
5 value="Test value"
6/>

With contextual action

Code

1<TextInput
2 id="test-control-12"
3 label="Test label" width="l" onChange={() => {}}
4 labelAction={() => {}}
5 labelActionText="Contextual action"
6 value="Test value"
7 width="l"
8/>

As a text input for numbers

Code

1<TextInput
2 id="test-control-13"
3 label="Test label" width="l" onChange={() => {}}
4 inputMode="numeric"
5 pattern="[0-9]*"
6/>