AccessibilityProps
One set of accessibility props, on every view and on both platforms:
label, hint, role (ARIA's names), live, actions and ARIA's
aria-* state and value facts (see docs/accessibility.md).
Verwendung
Make an icon-only button accessible.
// Make an icon-only button accessible.
import { Pressable, Symbol, type AccessibilityProps } from 'kuito';
// An icon button needs words for a screen reader: callers pass them through.
function IconButton(props: AccessibilityProps & { icon: string; onPress: () => void }) {
return (
<Pressable role="button" label={props.label} hint={props.hint} onPress={props.onPress}>
<Symbol name={props.icon} size={22} />
</Pressable>
);
}
<IconButton icon="heart" label="Like" hint="Adds the song to your likes" onPress={() => {}} />;Typdeklaration
export interface AccessibilityProps extends AccessibilityNativeProps {
role?: Prop<Role>;
/** The screen reader action taken, by `name`. */
onAction?: (event: AccessibilityActionEvent) => void;
}Mitglieder 17
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
role | Prop<Role> | Nein | — |
onAction | (event: AccessibilityActionEvent) => void | Nein | The screen reader action taken, by name. |
accessible | Prop<boolean> | Nein | Makes the view one screen reader element, read as its label or its children's text. |
label | Prop<string> | Nein | What a screen reader says for the view. |
hint | Prop<string> | Nein | What happens when the view is activated, read after the label. |
actions | Prop<readonly AccessibilityAction[]> | Nein | Actions a screen reader offers; onAction receives the one taken. |
live | Prop<"off" | "polite" | "assertive"> | Nein | ARIA's aria-live: announces changes to the view's content, on iOS too. |
aria-disabled | Prop<boolean> | Nein | — |
aria-selected | Prop<boolean> | Nein | — |
aria-checked | Prop<boolean | "mixed"> | Nein | — |
aria-busy | Prop<boolean> | Nein | — |
aria-expanded | Prop<boolean> | Nein | — |
aria-valuemin | Prop<number> | Nein | — |
aria-valuemax | Prop<number> | Nein | — |
aria-valuenow | Prop<number> | Nein | — |
aria-valuetext | Prop<string> | Nein | — |
onAction — Methodensignaturen
Signaturen
(event: AccessibilityActionEvent): voidParameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
event | AccessibilityActionEvent | Ja | — |
Rückgabe
void
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.