Button
Triggers an action or submits a form. One primary button per view, so the screen has a single obvious next step.
partially-compliant
- Overview
- Props
- Figma
General Guidelines
- One primary action per view. At most one primary CTA on a screen. The view should communicate one dominant user goal; avoid competing primary actions. Use different button types and sizes to show hierarchy—demote other actions to secondary, tertiary, or link style.
- Demote non-primary actions. Move less critical actions into an overflow menu (DropdownMenu), a later step/screen, or a less prominent section. If two or more actions are truly primary, split the experience into separate screens or steps.
- Each Button should represent one action and when triggered should have a very clear outcome.
- If you need a button with an icon without any text content, use the IconButton component instead.
| ✅ When to use | ❌ When not to use |
|---|---|
|
|
Configurations
Variants
Sizes
size also accepts one size per breakpoint, with the same keys as Heading or Stack's gap. Widths that no key matches use the default size (md, or sm in condensed themes). Sizes switch through CSS media queries, so it is safe with server-side rendering.
Icons Variant
Progress and Success States
Advanced usages
Polymorphic
By default, Button renders as a <button /> element on web. It's possible to render a different element instead. It's especially useful to render a link on web (or a Link from react-router-dom):
Button width in a VStack
The default behavior of the VStack is to extend childrens as much as possible. Here is how to set the content adapted width on your Button when it's in VStack:
Accessibility
The Button component's implementation already handles most of the accessibility requirements.
However, you might face some situations where you need to handle some of the accessibility requirements yourself.
In particlar, regarding the accessibile name.
A Button always needs an accessible name, which is the text that is read by screen readers to describe the button.
By default, the accessible name is the text inside the button.
If the text content is not meaningful, use the title, aria-label or aria-labelledby attribute to provide an accessible name for the button.
➡️ If the button only holds an icon (without text content), you must use the IconButton component instead.
To read more about the accessible name, check the Accessible Names documentation.
Playground
murray and murray/mobile.Button props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| disabled | booleanundefined | Indicated disabled state | ||
| externalPseudoState | "hovered""pressed"undefined | Externally controlled pseudo state for hover/press effects. Use this when the button is wrapped in a component that prevents normal event handling (e.g., Popover triggers with asChild). @internal - Primarily for internal Murray use | ||
| hasDropdownArrow | booleanundefined | Adds an arrow on the right. Use when the button triggers a dropdown or similar | ||
| hitSlop | numberInsetsnullundefined | Defines how far your touch can start away from the button on mobile @platform mobile | ||
| icon | 335 possibilities"Card""Menu""Accessible""AlanBlobHappy""AlanBlobHey""AlanBlobNoMouth""AlanBlobOpenMouth""AlanBlobSleeping""AlanLogo""Album""Alert""AlertAlt""Ambulance""AmbulanceSiren""Apple""AppleFilled""ArrowBottomLeft""ArrowBottomRight""ArrowDouble""ArrowDown""ArrowDownAlt""ArrowDropdown""ArrowDropright""ArrowDropup""ArrowLeft""ArrowLeftAlt""ArrowRight""ArrowRightAlt""ArrowTopLeft""ArrowTopRight""ArrowUp""ArrowUpAlt""ArrowUpDown""ArrowsLeftRight""Baby""BabyBottle""Back10""BadgeHeart""Bag""Bandaid""Bank""Bell""BellRinging""Bike""Bills""BirthdayCake""Block""BlurHeavy""BlurLight""BookHeart""Books""BooksAlt""BoxAdd""BoxArrowTopRight""Brain""Bubble""BubbleHeart""BubbleWithDots""Bus""Calculator""Calendar""CalendarClock""Camera""Cards""Carrot""ChatAdd""ChatAddFilled""ChatBubble""ChatDots""Check""CheckAlt""CheckboxActive""CheckboxInactive""Child""Children""Close""CloseAlt""CloudDownload""CloudUpload""Coffee""Company""Copy""Cross""DashboardMenuRight""DashboardMenuRightFilled""Devices""DockToBottom""DockToRight""Doctor""DoctorBag""Document""DocumentHeart""DotMenu""DoubleCheck""Driving""Drop""Dumbbells""Ear""Email""Enterprise""Euro""ExclamationMark""ExitFullscreen""ExternalLink""Eye""EyeOff""EyeOffStroke""FaceId""Facebook""FatArrowRight""FeatherPen""Female""FileUnknown""Filter""Finger""Flag""Flash""FlashDouble""FlashNo""FlashOutline""FlashYes""FlipCamera""Foot""Forward10""FrameProfile""FrameSearch""Fullscreen""Gender""Gift""GiftMind""Glasses""Globe""GlobeEarth""Graph""GraphicEq""Hand""HangUp""Heart""HeartAdd""HeartCheck""HeartStroke""HeartStrokeAdd""Home""HomeHeart""HomeMap""Hospital""HospitalMap""Hourglass""Intercom""Journal""Key""Keyboard""Label""LaptopHealth""Leaves""Levers""Lifebuoy""LightBulb""Link""Linkedin""List""Location""Lock""LockOpen""Lotus""MagnifyingGlass""Mail""Male""Map""MapLocation""Masterclass""MedicalChat""MedicalChatHeart""Medium""MenuDot""Mic""MicOff""Microscope""MindCard""MindInbox""MinusAlt""MobilePhone""Moon""MoonSleepy""MusicOff""MusicOffSingle""MusicOn""MusicOnSingle""NearMe""NewPost""NoFlash""NoSmoking""None""NoteAdd""Notion""PanelLeft""PanelLeftDashed""Paperclip""Paperplane""Pause""Payfit""PeachFilled""Pencil""People""PeopleTwo""PersonAdd""PersonRemove""Phone""PhoneHangUp""PhonePlus""Picture""Piggy""Pill""Pills""Play""Plus""PlusAlt""PrevenirLogo""Printer""Profile""ProfileSettings""Psychology""Quotes""RaisingHands""React""Refresh""Reply""Rotate""RotateBox""RoundedArrowDown""RoundedArrowLeft""RoundedArrowRight""RoundedArrowUp""RoundedCheck""RoundedCross""RoundedEmpty""RoundedExclamationMark""RoundedFull""RoundedHalf""RoundedHelp""RoundedHelpLine""RoundedInfo""RoundedInfoLine""RoundedLess""RoundedPlay""RoundedPlus""RoundedQuarter""RoundedThreeQuarters""RoundedWarning""Ruler""RulerFilled""Save""Scale""ScanBarcode""Screenshare""ScreenshareStop""Seringe""Settings""Share""ShareAndroid""ShareIos""ShareScreen""Shield""ShieldCog""ShieldHeart""Snowflake""SocialFb""SocialFbLine""SocialGoogle""SocialLinkedin""SocialLinkedinLine""SocialTwitter""SocialTwitterLine""Sparkles""Spiral""SplitLeft""SplitRight""SsoGoogle""SsoPsc""Star""Stethoscope""StoreBasket""StrawberryFilled""Subtitles""Subway""Sun""Swipe""Target""ThumbDownStroke""ThumbUpStroke""ThumbsDown""ThumbsUp""Tick""Time""TimeSimple""Tooth""ToothBrace""TouchId""TpCard""Tram""Transmission""TransportationBus""TransportationTrain""Trash""TreeGraph""TriangularExclamationMark""TurtleShell""Twitter""Umbrella""UmbrellaHeart""Undo""VideoCall""VideoHeart""VideoHorizontal""VideoHorizontalOutlined""VideoOff""VideoOn""VideoPlural""VideoVertical""VolumeOff""VolumeOn""VolumeUp""Walking""Wallet""Warning""WarningAlt""Wind""Work""WorkHeart""World""Wrench""X""ZoomIn""ZoomOut"undefined | Adds an icon to the left of the component | ||
| isActive | booleanundefined | Sets the button in a pressed state. | ||
| onMouseEnter | undefinedMouseEventHandler<HTMLDivElement> | |||
| onMouseLeave | undefinedMouseEventHandler<HTMLDivElement> | |||
| onPress | 3 possibilities((event: GestureResponderEvent) => void)nullundefined | |||
| onPressIn | 3 possibilities((event: GestureResponderEvent) => void)nullundefined | |||
| onPressOut | 3 possibilities((event: GestureResponderEvent) => void)nullundefined | |||
| pressedScale | numberundefined | Scale multiplier applied on press (e.g., 1.1 for 110% scale). When provided, button will animate scale on press. | ||
| progress | booleanundefined | Determines whether the Loader component should be displayed over the button | ||
| renderAs | 2 possibilitiesundefined | (props: { children: ReactNode; }) => ReactElement<unknown, stringJSXElementConstructor<any>> | |||
| size | 6 possibilitiesundefined"xs""sm""md""lg"Partial<Record<"$xs" | "$ltVs" | "$vs" | "$ltSm" | "$sm" | "$ltMd" | "$md" | "$ltLg" | "$lg" | "$ltXl" | "$xl" | "$ltXxl" | "$xxl", "xs" | "sm" | "md" | "lg">> | Controls overall size of the component. `md` by default (or `sm` if theme is condensed). Also accepts one size per breakpoint, e.g. `{ $xs: "md", $lg: "sm" }`: widths that no key matches use the default. | ||
| success | booleanundefined | Determines whether a success icon should be displayed over the button | ||
| sx | PositionPropsundefined | |||
| title | stringundefined | Tooltip shown on hover (web). Defaults to `aria-label`, so sighted users see what screen readers announce. | ||
| type | "button""submit""reset"undefined | button | ||
| variant | 8 possibilities"primary""secondary""tertiary""plain""flat""danger""danger-secondary"undefined | primary | Controls the looks (colors, shadows) of the component |
Undocumented props
| Name | Type | Default Value | Description | Usage count |
|---|---|---|---|---|
| aria-busy | any | |||
| aria-label | any | |||
| aria-pressed | any | |||
| css | any | |||
| data-id | any | |||
| data-intercom-workflow | any | |||
| data-testid | any | |||
| ref | any | |||
| style | any | |||
| testID | any |
Style API
Use sx for one-off adjustments. It accepts these style keys:
Each can be overridden per breakpoint with: