Skip to main content

Actions

Button​

Pill button with variant driven by class-variance-authority. Extends PressableProps.

npx midestic-rn-library add button
import { Button } from "./src/components/ui/button";

<Button title="Continue" variant="primary" size="md" fullWidth onPress={() => {}} />
<Button title="Cancel" variant="cancel" size="cancel" onPress={close} />
<Button title="Call driver" variant="call" size="call" leftIcon={<PhoneIcon />} onPress={call} />
<Button title="Loading" loading disabled onPress={() => {}} />

Props​

PropTypeDefaultDescription
titlestring-Label rendered inside the button
variantprimary | secondary | outline | ghost | cancel | wait | call | msg | dangerprimaryColour scheme
sizesm | md | lg | primary | cancel | wait | call | msg | dangermdHeight and label size
fullWidthbooleanfalseStretch to the container width
loadingbooleanfalseShow a spinner and ignore presses
disabledbooleanfalseDisabled state (from PressableProps)
leftIcon / rightIconReactNode-Icons next to the label
classNamestring""Extra classes on the container
textClassNamestring""Extra classes on the label
note

variant and size are paired: call/msg/cancel/danger sizes set the height used by the ride-app flows.