Skip to Content

Action Components

Action components are interactive elements that trigger operations when pressed. Both components share a consistent variant and size system, use useAnimatedPress for tactile press feedback, and respect the theme’s semantic color tokens.

import { Button, IconButton } from '@/common/components';

Button

A versatile button component with four visual variants, three sizes, loading state, and optional leading/trailing icons. Extends React Native’s PressableProps.

Basic Usage

<Button title="Submit" onPress={handleSubmit} /> <Button title="Secondary" variant="secondary" onPress={handlePress} /> <Button title="Outline" variant="outline" size="sm" onPress={handlePress} /> <Button title="Ghost" variant="ghost" onPress={handlePress} />

With Icons

import { Icon } from '@/common/components'; <Button title="Add Item" leftIcon={<Icon name="add-outline" size={18} variant="inverse" />} onPress={handleAdd} /> <Button title="Next" rightIcon={<Icon name="arrow-forward-outline" size={18} variant="inverse" />} onPress={handleNext} />

Loading State

When loading is true, the button displays a spinner and disables interaction.

<Button title="Saving..." loading onPress={handleSave} />

Full Width

<Button title="Sign In" fullWidth onPress={handleSignIn} />

Variants

VariantDescription
primarySolid brand-colored background (default)
secondaryMuted background for secondary actions
outlineTransparent with a border
ghostTransparent with no border, text only

Sizes

SizeDescription
smCompact — reduced padding and font size
mdStandard size (default)
lgLarge — increased padding and font size

Props

PropTypeDefaultDescription
titlestringrequiredText label displayed inside the button
variant'primary' | 'secondary' | 'outline' | 'ghost''primary'Visual style variant
size'sm' | 'md' | 'lg''md'Size of the button
loadingbooleanfalseShow a spinner and disable interaction
disabledbooleanfalseDisable the button
fullWidthbooleanfalseStretch to fill container width
leftIconReactNodeIcon element rendered before the title
rightIconReactNodeIcon element rendered after the title
onPress() => voidPress handler (inherited from PressableProps)

Button extends PressableProps (excluding children), so you can pass any standard pressable prop such as accessibilityLabel, testID, or hitSlop.


IconButton

A compact, icon-only button that shares the same variant and size system as Button. Ideal for toolbar actions, close buttons, and navigation controls.

Basic Usage

<IconButton icon="close-outline" accessibilityLabel="Close" onPress={handleClose} /> <IconButton icon="settings-outline" variant="primary" accessibilityLabel="Settings" onPress={handleSettings} />

Variants and Sizes

<IconButton icon="heart-outline" variant="outline" size="sm" accessibilityLabel="Like" /> <IconButton icon="trash-outline" variant="ghost" size="lg" accessibilityLabel="Delete" />

Loading State

<IconButton icon="refresh-outline" loading accessibilityLabel="Refreshing" onPress={handleRefresh} />

Props

PropTypeDefaultDescription
iconIoniconsNamerequiredIonicons icon name to display
accessibilityLabelstringrequiredScreen reader label (required for accessibility)
variant'primary' | 'secondary' | 'outline' | 'ghost''ghost'Visual style variant
size'sm' | 'md' | 'lg''md'Size of the button
loadingbooleanfalseShow a spinner instead of the icon
disabledbooleanfalseDisable the button
onPress() => voidPress handler

The accessibilityLabel prop is required on IconButton. Since there is no visible text label, the accessibility label is essential for screen reader users.

Last updated on