Skip to main content

Button

Primary action button with multiple color variants.

Import

import { Button } from '@multinaire/ui';

Usage

<Button
type="primary"
title="Submit"
onPress={() => console.log('Pressed!')}
/>

Props

PropTypeDefaultDescription
typeButtonType'primary'Color variant of the button. Defaults to 'primary'
titlestringButton label text
isLoadingbooleanfalseShow a loading animation and disable the button
onPress() => voidPress handler. When omitted the button renders in a disabled (dimmed) state
flexnumberFlex grow value
widthDimensionValueFixed width of the button
heightDimensionValuetheme mediumFixed height of the button. Defaults to the theme's medium height
marginSpacingPropsOuter margin
testIDstringtitleTest identifier for UI automation. Defaults to the title value

ButtonType

type ButtonType =
| 'primary' // Theme primary color
| 'secondary' // Theme secondary color
| 'surface' // Background variant color (subtle)
| 'success' // Theme success color
| 'warning' // Theme warning color
| 'error' // Theme error color

Variants

Primary

<Button type="primary" title="Primary Action" />

The primary button uses your theme's primary color. Use for main actions.

Secondary

<Button type="secondary" title="Secondary Action" />

Surface

<Button type="surface" title="Subtle Action" />

Surface buttons use the background variant color. Use for low-emphasis actions.

Success

<Button type="success" title="Confirm" />

Warning

<Button type="warning" title="Proceed with Caution" />

Error

<Button type="error" title="Delete" />

Loading State

const [loading, setLoading] = useState(false);

<Button
type="primary"
title="Submit"
isLoading={loading}
onPress={async () => {
setLoading(true);
await submitForm();
setLoading(false);
}}
/>

Full Width

<Button flex={1} type="primary" title="Full Width Button" />

Examples

Form Submit

<Container gap={8}>
<Input
placeholder="Email"
value={email}
onChangeText={setEmail}
/>
<Button
type="primary"
title="Sign Up"
isLoading={isSubmitting}
onPress={handleSubmit}
/>
</Container>

Action Buttons

<Container horizontal gap={8}>
<Button flex={1} type="surface" title="Cancel" onPress={onCancel} />
<Button flex={1} type="primary" title="Confirm" onPress={onConfirm} />
</Container>

Migration

The 'destructive' type has been removed. Use 'error' instead:

// Before
<Button type="error" title="Delete" />