Primitives
Animated Number Avatar Badge Button Button Group Toggle Toggle Group Checkbox Chip Countdown Divider Fab Grid Icon Image Input Search Input Textarea Label Loader Marquee Masked Input Message Bubble Notification Banner Offline Banner Progress Progress Ring Radio Group Range Slider Rating Separator Skeleton Slider Stack Stepper Switch Text Theme Toggle Ticker Typing IndicatorComposed
Accordion Achievement Badge Action Bar Action Sheet Action Swap Activity Rings Add to Cart Button Address Card Agenda List Alert Amount Keypad Animated Icons App Bar Audio Message Audio Recorder Autocomplete Avatar Group Balance Display Bar List Barcode Before After Biometric Gate Bloom Menu Bottom Sheet Paywall Sheet Side Sheet Breadcrumb Calendar Calendar Strip Card Carousel Cart Item Character Charts Chat Composer Chat List Item Choice Card Circle Reveal Coach Marks Collapsible Collapsible Header Color Picker Combobox Command Palette Comment Thread Confetti Consent Sheet Context Menu Copy Field Country Picker Coupon Input Currency Input Data Table Date Range Picker Day Schedule Dialog Dock Donut Chart Drawer Driver Card Dropdown Menu Drum Picker Emoji Picker Empty State Error State Event Card Expandable Control Fader Feature Gate File Picker Filter Bar Follow Button Form Gauge Glass Glass Cluster Glass Dock Morph Glass Fab Morph Glass Lab Glass Orb Glass Search Morph Glass Sheet Edge Gradient Button Headline New Heatmap Image Cropper Image Viewer Kanban Card Keyboard Avoiding Keyboard Toolbar Leaderboard Level Progress Lightbox Like Button Line Chart List Reorderable List Swipeable Row Location Card Location Search Map Sheet Map View Markdown View Media Controls Media Picker Media Tile Mention Input Meter Bar Mini Player Mood Slider Morphing Modal Multi Select Navigation Rail Notification Item Number Input Onboarding Pager Order Card Order Summary OTP Input Pagination Paper Clip New Parallax Header Pass Card Password Strength Payment Button Payment Card Payment Method Permission Primer Phone Input PIN Pad Polaroid New Poll Popover Post Card Postage Stamp New Price Tag Pricing Table Product Card Product Gallery Profile Header Promo Banner Prompt Input Property Card Pull To Refresh QR Code Quick Actions Quick Replies Rating Summary Reaction Picker Resend Timer Review Card Review Prompt Ride Option Save Button Scan Frame Scroll Spy Tabs Seat Map Section Header Section Index Segmented Control Select Share Button Share Sheet Shutter Button Signature Pad Slide to Confirm Slot Picker Smart Banner Social Login Button Sparkline Splash Screen Split Button Stat Card Stateful Button Status Dot Step Flow Steps Sticker New Stopwatch Stories Progress Stories Viewer Story Ring Streak Counter Streaming Text Success Seal Swipe Deck Tabs Tag Input Tape New Text Reveal Thinking Indicator Time Picker Timeline Timer Ring Tip Selector Toast Toolbar Tooltip Track Row Transaction Row Trip Progress Variant Picker Video Controls Waveform Weather Card Weekday Picker Zoom TransitionScreens
Account Switcher Biometric Setup Delete Account Forgot Password Grow Auth Login Login — Dark Stage Login — Dense Work Login — Editorial Login — Illustrated Login — Minimal Ink Login — Social Login — Video Loop Food Onboarding Onboarding Onboarding Dark Objects Onboarding Editorial Onboarding Illustrated Onboarding Personalize Onboarding Photo Carousel OTP Verification Passkey — Create Password Reset Permission — Notifications Phone Verification Onboarding Quiz Session Devices Signup Sign-up Chat Sign-up Photo Sheet Social Auth Split Auth Verify Identity Welcome AI Chat AI Assistant Channels List Chat Info Chat List Chat Media Chat Thread Create Group Group Info Message Requests New Message Kept Messages Accessibility Activity Log Appearance Authenticator Blocked Accounts Export Your Data Downloads Edit Profile Edit Profile — Rows Emergency Call Empty States Set Error State Send Feedback Device Locator Help Center Home — Bento Home — Dark Home — Editorial Home Feed Invite Friends Language & Region Linked Accounts Not Found (404) Notification Settings Notifications Password Vault Paywall Paywall — Comparison Paywall — Dark Stage Paywall — Editorial Paywall — Photo Paywall — Trial Timeline Privacy Profile Profile — Gamified Profile — Minimal Profile — Photo Hero QR Scanner Report Issue Saved Items Phone Time Search Search — Command Palette Search — Visual Account Health Settings Settings — Dark Device Settings — Search Storage & Data Terms & Privacy Dating Chat Dating Filters Profile Discover Its A Match Into You Matches Profile Detail Profile Editor Courier Matching Delivery History Delivery Support Package Schedule Parcel Tracking Proof Of Delivery Quick Aisle Quick Home Send Package Substitutions Add Payment Address Book Cart Categories Checkout Checkout — Steps Checkout Success Delivery Filters & Sort Flash Sale Gift Cards Loyalty Points Order Cancel Order Detail Orders Pay Later Checkout Payment Methods Product Detail Product Detail — Hero Product Grid Product Reviews Promo Codes Recently Viewed Return Items Search Results Shop Assistant Store Home Tip & Rate Courier Order Tracking Wishlist Write a Review Event Checkin Event Hero Events Discover My Tickets Seat Selection Ticket Checkout Add Card Bank Accounts Dashboard — Bento Bill Pay Budgets Card Details Crypto Portfolio Finance Dashboard Dashboard — Dark Exchange Currency Expense List Invoice Detail Manage Cards Plan Management Savings Goals Send Money Spending Analytics Split Bill Subscriptions Token Detail Token Swap Transactions Wallet Home Wallet Movers Courier Tracking Food Cart Food Home Food Orders Grocery List Recipe Detail Restaurant — Dark Restaurant Detail Activity Rings Fitness Home Habit Quest Habit Tracker Meal Planner Med Store Meditation Player Mood Check-in Nutrition Home Period Tracker Prior Auth Prior Auth Cases Quest Complete Run Tracking Rx Scan Sleep Tracker Telehealth Booking Walk Map Water Tracker Workout Complete Workout Detail Workout Session Applications Apply Company Interview Schedule Job Detail Job Feed Resume Saved Jobs Create Listing Item Chat Listing Detail Make Offer Market Checkout Market Home Market Search My Listings Offers Inbox Seller Profile Audiobook Player Camera Gallery Albums Game Store Mini Player Music Player Photo Editor Photo Gallery Playlist Detail Podcast Player Clips Feed Serene Home Sound Mixer Stories Video Call Video Player Article Reader Course Detail Event Detail Memory Onboarding Icon Lab Leaderboard Lesson Player Match Detail News Editorial News Home Plant Care Prediction Live Prediction Welcome Smart Home Standings Ticket Wallet Topics Follow Weather Detail Add Task Sheet Alarm Clock Calendar Day Calendar Month Doc Scanner File Manager Focus Timer Journal Kanban Board Mail Inbox Mail Thread Note Editor Notes List Reminders Task List Time Blocks Agent Profile Compare Homes Mortgage Calculator Property Detail Rental Application Saved Homes Schedule Tour Search List Search Map Complete Destination Driver Arriving Ev Charging History Home In Trip Matching Options Parking Receipt Safety Schedule Scooter Unlock Booking Confirmed Booking Review Booking Slots My Bookings Pro On The Way Provider Detail Provider List Rate Service Services Home Arc Create Arc Detail Arc Onboarding Avatar Creator Comments Sheet Create Post Explore Grid Followers List Hashtag Feed Mentions Post Detail Post Hero Social Profile Boarding Pass Booking Confirm Car Rental Trip Discover Flight Live Flight Preferences Flight Results Flight Search Hotel Detail Live Transit Trip — Map Day Trip — Rideshare Request Seat Select Travel Home Trip Itinerary Trip OnboardingNothing matches — try another word.
Button
Pill button that presses down under your finger, in eight styles from solid to glass, with a built-in loading state that swaps in place while an action runs.
Preview
import * as React from "react";
import { forwardRef } from "react";
import { Pressable, Text, type PressableProps, type GestureResponderEvent, type LayoutChangeEvent, } from "react-native";
import Animated, {
Easing,
cancelAnimation,
withRepeat,
useSharedValue,
useAnimatedStyle,
withSequence,
withSpring,
withTiming,
withDelay,
type SharedValue,
} from "react-native-reanimated";
import { cn, createVariant, useAsyncPress, useHaptic, usePressAnimation, useReducedMotion, useTheme, a11yProps, AnimatedPressable, LitEdge, ease, spring, tempo, timing, type A11yProps, } from "@lumioui/core";
import { Glass } from "../glass";
/** Press depth scales inversely with surface size — a small tap target needs
* a deeper dip to read as a press; a large surface needs less travel
* (the base press is 0.93; full-width lg CTAs keep the library's 0.97). */
const PRESSED_SCALE = { sm: 0.94, md: 0.95, lg: 0.97, icon: 0.94 } as const;
/** Busy swaps the label for three small dots that brighten in turn, in place —
* nothing sweeps across the pill. One cycle of the three dots. */
const BUSY_CYCLE_MS = tempo.roll * 2;
/** Resting and peak brightness of a busy dot. */
const DOT_REST = 0.3;
const DOT_SIZE = 6;
/** Loading swaps in place: the outgoing layer (label or spinner) dims to
* 0.96 while the incoming one ignites and settles 0.96→1 on spring.swap.
* Reduced motion keeps the opacity crossfade only. */
const SWAP_SCALE = 0.96;
const SWAP_DIM = { duration: timing.recede.duration, easing: Easing.bezier(...ease.in) };
const SWAP_IGNITE = { duration: timing.fast.duration, easing: Easing.bezier(...ease.out) };
/** `ripple`: a glow ignites at the touch point and spreads to 2× the
* longest side while it dims. A fading trace, not UI travel, so it may
* outlive the 300ms UI budget — two roll periods. */
const RIPPLE_MS = tempo.roll * 2;
const RIPPLE_OPACITY = 0.22;
const RIPPLE_FROM_SCALE = 0.15;
const rippleEase = Easing.bezier(...ease.out);
const buttonVariants = createVariant({
base: "flex-row items-center justify-center overflow-hidden",
variants: {
variant: {
// The primary action — filled accent (ink by default)
default: "bg-primary",
// Destructive action — red filled
destructive: "bg-destructive",
// Outline with a hairline border
outline: "border border-border bg-transparent",
// Subtle accent tint background
tinted: "bg-primary/15",
// Secondary — neutral fill, no border (one depth treatment)
secondary: "bg-secondary",
// No background, just text
ghost: "bg-transparent",
link: "bg-transparent",
// Lumio glass — the material supplies the surface
glass: "bg-transparent",
},
size: {
// sm 36 (inline row actions, hitSlop to 44) · md 44 (min touch target) ·
// lg 56 — the full-width screen CTA real apps use.
sm: "h-9 gap-1.5 px-4",
md: "h-11 gap-2 px-5",
lg: "h-14 gap-2 px-7",
icon: "h-11 w-11 gap-0 px-0",
},
radius: {
pill: "rounded-full",
xl: "rounded-3xl",
lg: "rounded-2xl",
md: "rounded-xl",
},
},
defaultVariants: { variant: "default", size: "md", radius: "pill" },
});
/** `tone` restyles the filled "default" variant for contexts where the accent
* pill is wrong — `inverse` is the boutique near-black CTA, `surface` a
* bordered card-colored button. Only meaningful with variant="default". */
const toneContainer = {
accent: "",
inverse: "bg-foreground",
surface: "bg-card border border-border",
} as const;
const toneText = {
accent: "",
inverse: "text-background",
surface: "text-foreground",
} as const;
/** Text-like children (string/number/array of them) belong inside the styled
* label Text — variant colors only reach them there. Elements (icons, views)
* must bypass it: they aren't text and RN can't nest views in Text. */
const isTextualChildren = (node: React.ReactNode): boolean =>
node == null ||
typeof node === "boolean" ||
typeof node === "string" ||
typeof node === "number" ||
(Array.isArray(node) && node.every(isTextualChildren));
const buttonTextVariants = createVariant({
base: "text-base font-semibold",
variants: {
variant: {
default: "text-primary-foreground",
destructive: "text-destructive-foreground",
outline: "text-foreground",
tinted: "text-primary-text",
secondary: "text-secondary-foreground",
ghost: "text-foreground",
link: "text-primary-text underline",
glass: "text-foreground",
},
size: {
sm: "text-sm",
md: "text-base",
lg: "text-[17px]",
icon: "text-base",
},
},
defaultVariants: { variant: "default", size: "md" },
});
export interface ButtonProps extends Omit<PressableProps, "style" | "children" | "onPress">, A11yProps {
/** Press handler — may return a Promise. With asyncTracking (default) the
* button enters the loading state until the promise settles. Declared as
* a union of signatures rather than `void | Promise<unknown>` so `void`
* keeps its leniency — handlers returning other values (e.g. a timeout
* id) still typecheck. */
onPress?:
| ((e: GestureResponderEvent) => void)
| ((e: GestureResponderEvent) => Promise<unknown>)
| null;
/** Visual style — "glass" is the glass material button. */
variant?: "default" | "destructive" | "outline" | "tinted" | "secondary" | "ghost" | "link" | "glass";
/** Fill voice for the default variant — `inverse` is the near-black CTA,
* `surface` a bordered card-colored button. Default "accent". */
tone?: "accent" | "inverse" | "surface";
/** Corner radius. Default "pill". */
radius?: "pill" | "xl" | "lg" | "md";
/** Size preset. */
size?: "sm" | "md" | "lg" | "icon";
/** Swap the label for busy dots and block presses while true. */
loading?: boolean;
/** Auto-track async onPress — when onPress returns a Promise, the button
* automatically enters loading state until it resolves. Default true. */
asyncTracking?: boolean;
/** @deprecated No effect: busy resolves by swapping the label back in place. */
sheenOnResolve?: boolean;
/** Haptic feedback on press. Default "light"; false to disable. */
haptic?: "light" | "medium" | "heavy" | false;
/** Override the press-dip scale (1 = none). ButtonGroup sets this to 1 on
* attached children — a scaled segment opens a gap in the weld. */
pressedScale?: number;
/** Extra NativeWind classes for the container. */
className?: string;
/** Extra classes for the label. */
textClassName?: string;
/** Icon rendered before the label. */
icon?: React.ReactNode;
/** Ignite a glow from the touch point that spreads as it dims (`ripple`).
* Off by default; skipped under reduced motion. */
ripple?: boolean;
children?: React.ReactNode;
}
/**
* Button — tactile, spring-animated, haptic-enabled pill.
* Craft details: heavy spring scale on press, a light overlay that fades in
* while held (physical "ink"). Busy swaps the label in place for three dots
* that brighten in turn, and resolving swaps the label back — the pill never
* snaps or resizes, and nothing sweeps across it. Faces stay flat — depth
* comes from the press, not from gloss or drop shadows.
*/
export const Button = forwardRef<React.ElementRef<typeof Pressable>, ButtonProps>(
function Button(
{
variant = "default",
size = "md",
tone = "accent",
radius = "pill",
loading = false,
asyncTracking = true,
// Kept for compatibility — busy now resolves by swapping the label back in, no light pass.
sheenOnResolve: _sheenOnResolve,
haptic = "light",
pressedScale,
className,
textClassName,
icon,
ripple = false,
children,
disabled,
onPress,
onPressIn,
onPressOut,
onLayout,
accessibilityLabel,
accessibilityHint,
accessibilityRole,
accessibilityState,
...props
},
ref
) {
const haptics = useHaptic();
const reduceMotion = useReducedMotion();
const { colors } = useTheme();
// Auto-track async onPress promises
const asyncPress = useAsyncPress(
asyncTracking ? (onPress ?? undefined) : undefined,
{
haptic: haptic ? () => haptics[haptic]() : undefined,
}
);
const isLoading = loading || asyncPress.loading;
const isDisabled = disabled || isLoading;
// Link buttons stay quiet but still acknowledge contact with a restrained
// scale. Opacity alone makes text actions feel disconnected from touch.
// `disabled` is folded into the animated style — an opacity className on
// the same element is overridden by the hook's inline style on web.
const press = usePressAnimation(
variant === "link"
? { pressedScale: 0.98, pressedOpacity: 0.72, disabled: !!disabled }
: { pressedScale: pressedScale ?? PRESSED_SCALE[size], disabled: !!disabled }
);
// Held-state ink overlay — a faint wash that confirms contact instantly.
const ink = useSharedValue(0);
// Busy — the label swaps out in place for three dots that brighten in
// turn; on resolve the dots dim and the label switches back on.
const labelOpacity = useSharedValue(isLoading ? 0 : 1);
const labelScale = useSharedValue(1);
const dotsOn = useSharedValue(isLoading ? 1 : 0);
const lap = useSharedValue(0);
const wasLoading = React.useRef(isLoading);
React.useEffect(() => {
if (!isLoading || reduceMotion) {
cancelAnimation(lap);
return;
}
lap.value = 0;
lap.value = withRepeat(withTiming(1, { duration: BUSY_CYCLE_MS, easing: Easing.linear }), -1, false);
return () => cancelAnimation(lap);
}, [isLoading, reduceMotion, lap]);
React.useEffect(() => {
if (wasLoading.current === isLoading) return;
wasLoading.current = isLoading;
if (isLoading) {
labelOpacity.value = withTiming(0, SWAP_DIM);
dotsOn.value = withDelay(timing.recede.duration, withTiming(1, SWAP_IGNITE));
if (!reduceMotion) labelScale.value = withTiming(SWAP_SCALE, SWAP_DIM);
return;
}
dotsOn.value = withTiming(0, SWAP_DIM);
labelOpacity.value = withDelay(timing.recede.duration, withTiming(1, SWAP_IGNITE));
if (reduceMotion) labelScale.value = 1;
else labelScale.value = withDelay(timing.recede.duration, withSpring(1, spring.swap));
}, [isLoading, reduceMotion, labelOpacity, labelScale, dotsOn]);
// Touch-point ripple (opt-in).
const rippleX = useSharedValue(0);
const rippleY = useSharedValue(0);
const rippleSize = useSharedValue(0);
const rippleP = useSharedValue(1);
const handleLayout = (e: LayoutChangeEvent) => {
const { width, height } = e.nativeEvent.layout;
rippleSize.value = Math.max(width, height) * 2;
onLayout?.(e);
};
const handlePress = (e: GestureResponderEvent) => {
if (asyncTracking) {
asyncPress.handlePress(e);
} else {
if (haptic) haptics[haptic]();
onPress?.(e);
}
};
const handlePressIn = (e: GestureResponderEvent) => {
press.onPressIn?.();
// The ink wash is opacity feedback — reduced motion keeps it.
ink.value = withTiming(1, timing.instant);
if (ripple && !reduceMotion) {
rippleX.value = e.nativeEvent.locationX;
rippleY.value = e.nativeEvent.locationY;
rippleP.value = withSequence(
withTiming(0, { duration: 0 }),
withTiming(1, { duration: RIPPLE_MS, easing: rippleEase })
);
}
onPressIn?.(e);
};
const handlePressOut = (e: GestureResponderEvent) => {
press.onPressOut?.();
ink.value = withTiming(0, timing.normal);
onPressOut?.(e);
};
const inkStyle = useAnimatedStyle(() => ({ opacity: ink.value * 0.12 }));
// The pill itself never resizes — only the content inside it swaps.
const labelStyle = useAnimatedStyle(() => ({
opacity: labelOpacity.value,
transform: [{ scale: labelScale.value }],
}));
const dotsStyle = useAnimatedStyle(() => ({ opacity: dotsOn.value }));
const rippleStyle = useAnimatedStyle(() => {
const size = rippleSize.value;
return {
left: rippleX.value - size / 2,
top: rippleY.value - size / 2,
width: size,
height: size,
borderRadius: size / 2,
opacity: RIPPLE_OPACITY * (1 - rippleP.value),
transform: [{ scale: RIPPLE_FROM_SCALE + (1 - RIPPLE_FROM_SCALE) * rippleP.value }],
};
});
const filled = variant === "default" || variant === "destructive";
// Ink wash from theme tokens: primaryForeground (white) on filled,
// foreground (scheme-aware) on translucent surfaces.
const inkColor = filled ? colors.primaryForeground : colors.foreground;
const lightColor =
variant === "default"
? tone === "inverse"
? colors.background
: tone === "surface"
? colors.foreground
: colors.primaryForeground
: variant === "destructive"
? colors.destructiveForeground
: variant === "tinted" || variant === "link"
? colors.primary
: colors.foreground;
return (
<AnimatedPressable
ref={ref}
disabled={isDisabled}
onPress={handlePress}
onPressIn={handlePressIn}
onPressOut={handlePressOut}
onLayout={handleLayout}
// sm is 36px visually — expand the hit area to 44pt so it doesn't
// feel broken. md/lg/icon are exactly 44pt+; hitSlop 2 adds a small
// buffer for edge misses without overlapping neighbors.
hitSlop={size === "sm" ? 4 : 2}
style={press.animatedStyle}
className={cn(
buttonVariants({ variant, size, radius }),
variant === "default" && toneContainer[tone],
// Busy keeps full strength — the dots say "working", not "unavailable".
disabled && "opacity-50",
className
)}
{...a11yProps(
{ accessibilityLabel, accessibilityHint, accessibilityRole, accessibilityState },
"button"
)}
accessibilityState={{ disabled: isDisabled, busy: isLoading, ...accessibilityState }}
// accessibilityState isn't forwarded to the DOM on web — mirror
// disabled/busy with explicit aria-* like Switch/Toggle do.
aria-disabled={isDisabled}
aria-busy={isLoading}
{...props}
>
{variant === "glass" ? (
<Glass
effect="regular"
sheen={0.55}
bend={0.25}
interactive
className="absolute inset-0"
style={{ borderRadius: radius === "pill" ? 999 : radius === "xl" ? 24 : radius === "lg" ? 16 : 12 }}
pointerEvents="none"
/>
) : null}
{/* Lit edge — the Lumio material on raised fills */}
{filled || variant === "secondary" ? (
<LitEdge
tone={filled && tone !== "surface" ? "fill" : "surface"}
radius={radius === "pill" ? 999 : radius === "xl" ? 24 : radius === "lg" ? 16 : 12}
/>
) : null}
{/* Ink overlay — held state */}
<Animated.View
pointerEvents="none"
style={[
{
position: "absolute",
top: 0,
left: 0,
right: 0,
bottom: 0,
backgroundColor: inkColor,
},
inkStyle,
]}
/>
{ripple && !reduceMotion ? (
<Animated.View
pointerEvents="none"
style={[{ position: "absolute", backgroundColor: inkColor }, rippleStyle]}
/>
) : null}
{/* Label layer — fades/shrinks out when loading starts */}
<Animated.View
style={[{ flexDirection: "row", alignItems: "center", gap: 8 }, labelStyle]}
>
{icon}
{isTextualChildren(children) ? (
<Text
className={cn(
buttonTextVariants({ variant, size }),
variant === "default" && toneText[tone],
textClassName
)}
>
{children}
</Text>
) : (
children
)}
</Animated.View>
{/* Busy — three dots in the label's place, brightening in turn. */}
<Animated.View
pointerEvents="none"
accessibilityElementsHidden
importantForAccessibility="no-hide-descendants"
style={[{ position: "absolute", top: 0, left: 0, right: 0, bottom: 0, flexDirection: "row", alignItems: "center", justifyContent: "center", gap: DOT_SIZE }, dotsStyle]}
>
{[0, 1, 2].map((i) => (
<BusyDot key={i} index={i} lap={lap} color={lightColor} still={reduceMotion} />
))}
</Animated.View>
</AnimatedPressable>
);
}
);
Button.displayName = "Button";
/** One busy dot: brightens as the cycle passes its turn, then rests. Opacity
* only — the dots never travel, and reduced motion holds them half lit. */
function BusyDot({ index, lap, color, still }: { index: number; lap: SharedValue<number>; color: string; still: boolean }) {
const style = useAnimatedStyle(() => {
if (still) return { opacity: 0.6 };
const t = (((lap.value - index / 3) % 1) + 1) % 1;
const peak = t < 0.5 ? Math.sin(t * 2 * Math.PI) : 0;
return { opacity: DOT_REST + (1 - DOT_REST) * Math.max(0, peak) };
});
return <Animated.View style={[{ width: DOT_SIZE, height: DOT_SIZE, borderRadius: DOT_SIZE / 2, backgroundColor: color }, style]} />;
}
export { buttonVariants, buttonTextVariants }; import { Button } from "@/components/ui/button/button";
export function Example() {
return (
<Button />
);
} Installation
Install the dependencies
npx expo install react-native-reanimatedAdd the components it builds on
Copy the source from the Code tab into your project
components/ui/button/button.tsxcomponents/ui/button/index.tsUpdate the import paths to match your project setup.
Usage
import { Button } from "@/components/ui/button/button"; <Button /> Examples
Glass CTAs over a full-bleed photo, where glass earns its keep.
import * as React from "react";
import { Image, StyleSheet, View, Text } from "react-native";
import { Button } from "../button";
import { Icon } from "../../icon/icon";
const PHOTO =
"https://images.unsplash.com/photo-1528360983277-13d401cdc186?w=800&h=1000&fit=crop&q=70&auto=format";
/** ButtonGlass — glass CTAs over a full-bleed photo, where glass earns its keep. */
export function ButtonGlass() {
return (
<View className="relative h-[420px] w-full overflow-hidden rounded-2xl bg-muted">
<Image source={{ uri: PHOTO }} style={StyleSheet.absoluteFill} resizeMode="cover" accessibilityIgnoresInvertColors />
<View className="absolute inset-x-0 bottom-0 gap-3 bg-black/40 px-5 pb-6 pt-5">
<View>
<Text className="text-xl font-semibold text-white">Gion after dark</Text>
<Text className="mt-0.5 text-sm text-white/90">Walking tour · 2 h · 4.9 (812)</Text>
</View>
<Button variant="glass" size="lg" icon={<Icon name="play" size="sm" color="foreground" />}>
Watch preview
</Button>
<View className="flex-row gap-2">
<Button variant="glass" size="sm" className="flex-1">Save</Button>
<Button
variant="glass"
size="icon"
accessibilityLabel="Share"
icon={<Icon name="share" size="sm" color="foreground" />}
/>
</View>
</View>
</View>
);
} Each size where it lives in a real app: sm as app-store row pills, md as profile actions, lg as the full-width screen CTA.
import * as React from "react";
import { View } from "react-native";
import { Button } from "../button";
import { Icon, type IconName } from "../../icon/icon";
import { Text } from "../../text/text";
const APPS: { name: string; blurb: string; glyph: IconName; tile: string; action: string }[] = [
{ name: "Aperture One", blurb: "Manual controls for every shot", glyph: "camera", tile: "bg-neutral-900 dark:bg-neutral-700", action: "Install" },
{ name: "Tidy Lists", blurb: "Tasks, beautifully planned", glyph: "check", tile: "bg-tint-orange", action: "$9.99" },
{ name: "Nimbus", blurb: "Hyperlocal forecasts", glyph: "droplet", tile: "bg-tint-teal", action: "Open" },
];
/** ButtonSizes — each size where it lives in a real app: sm as app-store row
* pills, md as profile actions, lg as the full-width screen CTA. The CTA is
* async: tap it and the label crossfades to a spinner until it resolves. */
export function ButtonSizes() {
const [installed, setInstalled] = React.useState(false);
const install = async () => {
await new Promise((r) => setTimeout(r, 1400));
setInstalled(true);
};
return (
<View className="w-full gap-6">
<View className="w-full rounded-2xl bg-card px-4">
{APPS.map((app, i) => (
<View
key={app.name}
className={`flex-row items-center gap-3 py-3 ${i > 0 ? "border-t border-border" : ""}`}
>
<View className={`h-14 w-14 items-center justify-center rounded-2xl ${app.tile}`}>
<Icon name={app.glyph} size="md" color="#FFFFFF" />
</View>
<View className="flex-1">
<Text className="text-base font-semibold">{app.name}</Text>
<Text variant="muted" numberOfLines={1}>{app.blurb}</Text>
</View>
<Button size="sm" variant="secondary" className="min-w-[72px]">
{app.action}
</Button>
</View>
))}
</View>
<View className="w-full flex-row items-center gap-2">
<Button size="md" className="flex-1">Follow</Button>
<Button size="md" variant="secondary" className="flex-1">Message</Button>
<Button
size="icon"
variant="secondary"
icon={<Icon name="share" size="sm" color="foreground" />}
accessibilityLabel="Share profile"
/>
</View>
<Button size="lg" className="w-full" onPress={install} disabled={installed}>
{installed ? "Installed" : "Install Aperture One"}
</Button>
</View>
);
} Every voice on one real surface, loudest to quietest: the filled accent CTA, a secondary beside it, tinted and outline for inline choices, a link, and destructive kept apart at the bottom.
import * as React from "react";
import { View } from "react-native";
import { Button } from "../button";
import { Icon } from "../../icon/icon";
import { Text } from "../../text/text";
/** ButtonStyles — every voice on one real surface, loudest to quietest: the
* filled accent CTA, a secondary beside it, tinted and outline for inline
* choices, a link, and destructive kept apart at the bottom. */
export function ButtonStyles() {
return (
<View className="w-full">
<View className="w-full gap-5 rounded-3xl bg-card p-5">
<View className="items-center gap-1 pt-2">
<Text variant="muted">You're sending</Text>
<Text className="text-5xl font-semibold tracking-tight tabular-nums">$240.00</Text>
<Text variant="muted">to Maya Okafor · arrives instantly</Text>
</View>
<View className="flex-row gap-2">
<Button variant="tinted" size="sm" className="flex-1">Split it</Button>
<Button variant="outline" size="sm" className="flex-1">Add note</Button>
<Button variant="outline" size="sm" className="flex-1">Schedule</Button>
</View>
<View className="gap-2">
<Button size="lg" className="w-full" icon={<Icon name="send" size="sm" color="primaryForeground" />}>
Send now
</Button>
<Button size="lg" variant="secondary" className="w-full">Edit amount</Button>
</View>
<View className="flex-row items-center justify-between border-t border-border pt-3">
<Button variant="link" size="sm">Fees and limits</Button>
<Button variant="ghost" size="sm" textClassName="text-destructive">Cancel transfer</Button>
</View>
</View>
</View>
);
} API reference
onPress ((e: GestureResponderEvent) => void) …
((e: GestureResponderEvent) => void) | ((e: GestureResponderEvent) => Promise<unknown>) | null Press handler — may return a Promise. With asyncTracking (default) the button enters the loading state until the promise settles. Declared as a union of signatures rather than void | Promise<unknown> so void keeps its leniency — handlers returning other values (e.g. a timeout id) still typecheck.
variant "default" | "destructive" +6
"default" | "destructive" | "outline" | "tinted" | "secondary" | "ghost" | "link" | "glass" Visual style — "glass" is the glass material button.
"default" tone "accent" | "inverse" | "surface" Fill voice for the default variant — inverse is the near-black CTA, surface a bordered card-colored button. Default "accent".
"accent" radius "pill" | "xl" +2
"pill" | "xl" | "lg" | "md" Corner radius. Default "pill".
"pill" size "sm" | "md" +2
"sm" | "md" | "lg" | "icon" Size preset.
"md" loading boolean Swap the label for busy dots and block presses while true.
false asyncTracking boolean Auto-track async onPress — when onPress returns a Promise, the button automatically enters loading state until it resolves. Default true.
true sheenOnResolve boolean @deprecated No effect: busy resolves by swapping the label back in place.
—haptic "light" | "medium" | "heavy" | false Haptic feedback on press. Default "light"; false to disable.
"light" pressedScale number Override the press-dip scale (1 = none). ButtonGroup sets this to 1 on attached children — a scaled segment opens a gap in the weld.
—className string Extra NativeWind classes for the container.
—textClassName string Extra classes for the label.
—icon React.ReactNode Icon rendered before the label.
—ripple boolean Ignite a glow from the touch point that spreads as it dims (ripple). Off by default; skipped under reduced motion.
false children React.ReactNode —