React Aria
Interactive components wrap React Aria Components. React Aria supplies their behavior, state, and accessibility.
Props
A component accepts the props of the React Aria component that it wraps. The API reference on a component page lists the props that vip/ui adds. It links to the React Aria props for the rest.
Forms
The vip/ui Form wraps the React Aria Form. It renders a native <form> element.
- To submit, use
actionoronSubmit. - To read values, use
FormDataor controlledvalueandonChangeprops. - To validate, use native constraints, such as
isRequired, or avalidatefunction. - To show server errors, pass
validationErrorsto the form. Use the field names as keys.
Each field shows its error message below the input.
Internationalization
React Aria uses the browser locale by default. To set a different locale, wrap your app in I18nProvider. vip/ui does not add the provider.
- Date, time, number, and calendar components use the locale to format values.
- Components get the reading direction from the locale.
I18nProviderdoes not change validation messages. They use the browser language.
Contexts and slots
React Aria components send props to their parts through React context. A NumberField gives its increment and decrement buttons their onPress handlers. Slots identify repeated parts, such as slot="increment" and slot="decrement". Props that you set on a part override the context props.
To replace a part with your own, use the parent context. Do not write the behavior again.
useContextPropsmerges your props with the context props. It supports theslotprop.useSlottedContextreads the context value without a merge.- State contexts give the parent state. vip/ui uses
DisclosureStateContextto animate disclosure panels.