ZUI

Search documentation

Find a page or a heading.

Button

A pressable control announced as a button, in the style's variants and sizes.

Installation

bash

The CLI writes components/ui/button.tsx, installs Text, Icon and Utils, and adds class-variance-authority.

Usage

tsx
tsx

The label goes in as a Text child, which takes the colour and size of the button's variant and size; an Icon child takes the label's colour and the size's icon size.

API reference

Button

Takes every prop React Native's Pressable takes, plus:

It sets role="button". disabled blocks presses and is announced through accessibilityState. The icon sizes are square, for a button whose only child is an Icon.

buttonVariants

The view classes of each variant and size, for a pressable that is not a Button but should look like one. buttonTextVariants gives the matching label classes.