Skip to main content
Brand and assets
Build
Monitor and contribute
/
Component library
  • All components
  • Buttons & actions
    • BackButton
    • Button
    • HighlightButton
    • IconButton
    • SemanticButton
  • Forms & inputs
  • Layout & containers
  • Overlays
  • Feedback & status
  • Data display
  • Typography
  • Accessibility
  • Contrib
  • Deprecated
  • Buttons & actions
  • Button

Button

Triggers an action or submits a form. One primary button per view, so the screen has a single obvious next step.

Health
Component health
Source
View on Github
Design
View Figma
Storybook
View in Storybook
Playground
No Example
Accessibility

partially-compliant

Platform
Universal
Accessibility issues
The progress and success state are not focusable. The danger variants miss a visual indication of the danger state for colorblind users. The as attribute can break accessibility if not used with an interactive element. `hasDropdownArrow` prop is not announced by screen readers. Icon is not described when using it without a label.
  • 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
  • Communicating actions users can take
  • Drawing attention to relevant actions in a user's workflow
  • Helping users scan content on a page and understand what is expected of them
  • To make text inside paragraphs or lists actionable: use a text link
  • To simply navigate to a new URL: use a link (it can look like a button, see below)
  • To redirect users to an Android or Apple app store page: use a StoreBadge.
  • To launch services (such as chat with a doctor) on an app: use a ButtonService.

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):

Link

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​

Loading...
tip
This component is universal, its usage is the same in murray and murray/mobile.

Button props

NameTypeDefault ValueDescriptionUsage count
disabledbooleanundefinedIndicated disabled state
externalPseudoState"hovered""pressed"undefinedExternally 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
hasDropdownArrowbooleanundefinedAdds an arrow on the right. Use when the button triggers a dropdown or similar
hitSlopnumberInsetsnullundefinedDefines 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
isActivebooleanundefinedSets the button in a pressed state.
onMouseEnterundefinedMouseEventHandler<HTMLDivElement>
onMouseLeaveundefinedMouseEventHandler<HTMLDivElement>
onPress
3 possibilities((event: GestureResponderEvent) => void)nullundefined
onPressIn
3 possibilities((event: GestureResponderEvent) => void)nullundefined
onPressOut
3 possibilities((event: GestureResponderEvent) => void)nullundefined
pressedScalenumberundefinedScale multiplier applied on press (e.g., 1.1 for 110% scale). When provided, button will animate scale on press.
progressbooleanundefinedDetermines 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.
successbooleanundefinedDetermines whether a success icon should be displayed over the button
sxPositionPropsundefined
titlestringundefinedTooltip shown on hover (web). Defaults to `aria-label`, so sighted users see what screen readers announce.
type"button""submit""reset"undefinedbutton
variant
8 possibilities"primary""secondary""tertiary""plain""flat""danger""danger-secondary"undefined
primaryControls the looks (colors, shadows) of the component

Undocumented props

NameTypeDefault ValueDescriptionUsage count
aria-busyany
aria-labelany
aria-pressedany
cssany
data-idany
data-intercom-workflowany
data-testidany
refany
styleany
testIDany

Style API​

Use sx for one-off adjustments. It accepts these style keys:

alignSelfanimationaspectRatiobottomcursordisplayendflexflexBasisflexGrowflexShrinkheightinsetinsetInlineinsetInlineEndinsetInlineStartleftmarginmarginBottommarginHorizontalmarginInlinemarginInlineEndmarginInlineStartmarginLeftmarginRightmarginTopmarginVerticalmatrixmaxHeightmaxWidthminHeightminWidthopacityperspectivepositionrightrotaterotateXrotateYrotateZscalescaleXscaleYskewXskewYstarttoptransformtransformOriginwidthxyzIndex

Each can be overridden per breakpoint with:

$lg$ltLg$ltMd$ltSm$ltVs$ltXl$ltXxl$md$sm$vs$xl$xs$xxl
Edit this page
Previous
BackButton
Next
HighlightButton
  • General Guidelines
  • Configurations
    • Variants
    • Sizes
    • Icons Variant
    • Progress and Success States
  • Advanced usages
    • Polymorphic
    • Button width in a VStack
  • Accessibility
  • Playground