Composants
Field
A form field: a label, a hint and an error around an Input, a Textarea or a native Select.
Web et mobile — le même composant pour React et React Native. Stable : son API ne change qu’à une version majeure.
Pourquoi il est là. Used by Orochia, Orazaka.
Quand l’utiliser
- For every text entry of a form: email, title, description, amount.
Selectfor a choice among many options (a country): the platform's own menu, right on phones.
Quand ne pas l’utiliser
- To turn a setting on or off.À la place : Switch
- To choose among two to five options that should all be visible.À la place : Radio group
- To pick a number in a range by feel.À la place : Slider
Installation
Installer
npm install @krizaka/ui @krizaka/tailwind @krizaka/tokens tailwindcssStyles
@import "tailwindcss";
@import "@krizaka/tailwind";
@import "@krizaka/ui/tailwind.css";Importer
import { Field, Input, Textarea, Select } from "@krizaka/ui/field";Exemples
Default
A label, an input and a hint.
We never share it.
Invalid
invalid and its error, read through aria-describedby.
Enter a complete address.
Disabled
Not editable.
Textarea
A longer text.
Select
A native select.
Props
Input
| Prop | Type | Défaut | Description |
|---|---|---|---|
invalid | boolean | — | Marks the control invalid: aria-invalid and data-invalid (pair it with a Field.Error in aria-describedby). |
Select
A native <select>, styled like the other controls (the platform's menu: accessible and right on phones).
| Prop | Type | Défaut | Description |
|---|---|---|---|
invalid | boolean | — | Marks the control invalid: aria-invalid and data-invalid (pair it with a Field.Error in aria-describedby). |
Textarea
| Prop | Type | Défaut | Description |
|---|---|---|---|
invalid | boolean | — | Marks the control invalid: aria-invalid and data-invalid (pair it with a Field.Error in aria-describedby). |
Accessibilité
- Plain HTML wiring:
Field.Label htmlFor= the control'sid; hint and error ids inaria-describedby. invalidsetsaria-invalidanddata-invalidon the control.- A disabled control is skipped by Tab: if the value matters, prefer
readOnly.
Bonnes pratiques
- Always a visible
Field.Label: a placeholder is an example, never the label. - Put the hint before the error is possible (“We never share it”), the error after it is: what is wrong and how to fix it.
- Use the right
type(email,url,number) andautoComplete: phones show the right keyboard.
Composants liés
Générée depuis le code de @krizaka/ui 3.9.0 : son meta.ts, ses exemples et ses types.Modifier cette documentation sur GitHub