Button
A Button is the Button primitive with a look. On the Web it is
a real <button>, or an <a> when it has an href; on React Native it is a
Pressable with the button role.
Last pressed: nothing yet
import { Text, View } from '@hozo/core'import { Button } from '@hozo/ui'import { useState } from 'react'
export function ButtonDemo() { const [pressed, setPressed] = useState('nothing yet') return ( <View className="gap-4"> <View className="flex-row flex-wrap gap-2"> <Button tone="accent" onPress={() => setPressed('Accent')}> Accent </Button> <Button tone="neutral" onPress={() => setPressed('Neutral')}> Neutral </Button> <Button tone="quiet" onPress={() => setPressed('Quiet')}> Quiet </Button> <Button tone="danger" onPress={() => setPressed('Danger')}> Danger </Button> <Button tone="accent" size="sm" onPress={() => setPressed('Small')}> Small </Button> <Button tone="neutral" disabled onPress={() => setPressed('Disabled')}> Disabled </Button> </View> <Text className="text-sm text-hozo-text-muted">Last pressed: {pressed}</Text> </View> )}tone:accent,neutral(the default),quietordanger. Use oneaccentper view, for the action the view is for.size:md(the default, 44px tall) orsm(36px). Both are larger than the 24px WCAG 2.5.8 asks for.disabled: sets the realdisabledattribute, and the disabled look is styled from that attribute, so the two cannot disagree.href: makes it a link that looks like a button.
Everything else, such as onPress and accessibilityLabel, is the
primitive’s and passes straight through.