Skip to content

Commit f9344e5

Browse files
committed
docs(TextInput): Improve docs
1 parent c9a1284 commit f9344e5

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

src/components/TextInput/TextInput.mdx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,16 +196,28 @@ Multiple errors.
196196

197197
<Story of={TextInputStories.WithDescription} />
198198

199+
## Customisation
200+
201+
You can customise the component using the `rootClass` and `rootStyle` props to apply top-level styles. You can also use the provided CSS variables to alter deep styles.
202+
203+
- `--j-textinput-height` | **Type:** [`height`](https://developer.mozilla.org/en-US/docs/Web/CSS/height) | **Default:** `2.5rem` | The height of the input element.
204+
205+
<Story of={TextInputStories.Custom} />
206+
199207
## Behaviour
200208

201209
### Width
202210

203211
This component will take up the full width of the parent component by default. You can use the `rootClass` or `rootStyle` props to set a custom width.
204212

213+
The minimum width is 1.5&times; the `--j-textinput-height` variable.
214+
205215
## Accessibility
206216

207217
This component uses native HTML behaviour for `<input />` elements. This means that it will be keyboard navigable and screen reader friendly out of the box.
208218

219+
`aria-invalid` is added to the `<input />` element when the `status` prop is set. This will be set to `true` when `status="error"` and `false` when `status="success"`.
220+
209221
`aria-describedby` is added to the `<input />` element when the `description` slot is used to associate this content with the input.
210222

211223
`aria-errormessage` is added to the `<input />` element when the `error` slot is used to associate this content with the input.

src/components/TextInput/TextInput.stories.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,12 @@ export const WithDescription: Story = {
208208
description: '<p>Enter your <strong>full</strong> name</p>'
209209
}
210210
};
211+
212+
export const Custom: Story = {
213+
args: {
214+
id: 'custom',
215+
label: 'Label',
216+
rootStyle: `
217+
--j-textinput-height: 4rem;`
218+
}
219+
};

0 commit comments

Comments
 (0)