UI: Button
Button und IconButton in den vier Varianten des Desktops. Importiere die Token-Datei einmal (@pithyx/ui/tokens.css) und umschließe die App mit UiProvider; siehe @pithyx/ui.
Beim Build aus den TSDoc-Kommentaren von @pithyx/ui 1.0.0-rc.9 erzeugt; der Text unter den Überschriften ist der Kommentar im Quelltext und bleibt Englisch.
Schnittstellen
Abschnitt betitelt „Schnittstellen“ButtonProps
Abschnitt betitelt „ButtonProps“The props of Button: React Aria’s button props plus the look.
Erweitert
Abschnitt betitelt „Erweitert“Omit<AriaButtonProps,"className"|"children">
Eigenschaften
Abschnitt betitelt „Eigenschaften“variant?
Abschnitt betitelt „variant?“optional variant?: ButtonVariant;How much the button stands out; secondary when left out.
optional size?: "md" | "sm";sm for dense rows and toolbars; md when left out.
className?
Abschnitt betitelt „className?“optional className?: string;Extra class names, added after the button’s own.
children?
Abschnitt betitelt „children?“optional children?: ReactNode;The label, an icon or both.
IconButtonProps
Abschnitt betitelt „IconButtonProps“The props of IconButton.
Erweitert
Abschnitt betitelt „Erweitert“Omit<ButtonProps,"aria-label">
Eigenschaften
Abschnitt betitelt „Eigenschaften“variant?
Abschnitt betitelt „variant?“optional variant?: ButtonVariant;How much the button stands out; secondary when left out.
Geerbt von
Abschnitt betitelt „Geerbt von“optional size?: "md" | "sm";sm for dense rows and toolbars; md when left out.
Geerbt von
Abschnitt betitelt „Geerbt von“Omit.size;className?
Abschnitt betitelt „className?“optional className?: string;Extra class names, added after the button’s own.
Geerbt von
Abschnitt betitelt „Geerbt von“children?
Abschnitt betitelt „children?“optional children?: ReactNode;The label, an icon or both.
Geerbt von
Abschnitt betitelt „Geerbt von“label: string;Accessible name, also shown as tooltip.
tooltip?
Abschnitt betitelt „tooltip?“optional tooltip?: boolean;Hides the tooltip where the label is already visible nearby.
Typenaliasse
Abschnitt betitelt „Typenaliasse“ButtonVariant
Abschnitt betitelt „ButtonVariant“type ButtonVariant = 'primary' | 'secondary' | 'quiet' | 'danger';How much a button stands out: primary for the main action, danger for a destructive one.
Funktionen
Abschnitt betitelt „Funktionen“Button()
Abschnitt betitelt „Button()“function Button(props): Element;A button in the desktop’s look. Use onPress instead of onClick, so keyboard, touch and screen readers act alike,
and isPending for an action that runs.
Parameter
Abschnitt betitelt „Parameter“| Parameter | Typ | Beschreibung |
|---|---|---|
props |
ButtonProps |
React Aria’s button props plus variant and size. |
Rückgabewert
Abschnitt betitelt „Rückgabewert“Element
The button element.
Beispiel
Abschnitt betitelt „Beispiel“<Button variant="primary" onPress={save}> Save</Button>IconButton()
Abschnitt betitelt „IconButton()“function IconButton(props): Element;A button that shows only an icon; its label is announced and shown as a tooltip. quiet when no variant is set.
Parameter
Abschnitt betitelt „Parameter“| Parameter | Typ | Beschreibung |
|---|---|---|
props |
IconButtonProps |
The props of Button plus label and tooltip. |
Rückgabewert
Abschnitt betitelt „Rückgabewert“Element
The button, wrapped in a tooltip trigger unless tooltip is false.
Beispiel
Abschnitt betitelt „Beispiel“<IconButton label="Delete" onPress={remove}> <IconTrash size={18} /></IconButton>