Skip to content
Magma Design System
Button<mds-button>Generated from @maggioli-design-system/magma@2.3.0dist/documentation.json. Encapsulation: shadow.
Magma components are web components: custom elements you write like HTML tags, with any framework or without one. Props configure them, events tell you what happened, methods are functions you call on the element and slots take the content you put inside it.
Props
Set a prop as an HTML attribute in the markup, or as a property from JavaScript. The Attribute column gives the name of the attribute, a dash when it is the same as the property; props without one, such as arrays and functions, are set from JavaScript only. To turn a boolean attribute off, remove it: never write disabled="false".active - booleanSpecifies if the button is active or not
animation - none | yugop | undefinednoneSpecifies if the text is animated when it is rendered
autoFocusauto-focusbooleanSpecifies if the component is focused when is loaded on the viewport
await - boolean | undefinedSpecifies if the button is awaiting for a response
disabled - boolean | undefinedSpecifies if the component is disabled or not
href - string | undefinedTurns the button into a link to this URL: a real anchor in its shadow root, so the browser gives it what it gives every link (new tab on a modifier or middle click, the context menu, drag). A client-side router takes the plain clicks over once registered with NavigationService.setHandler() (from @maggioli-design-system/magma/services); without one, a click listener on the host can still cancel the navigation with preventDefault().
icon - string | undefinedThe icon displayed in the button
iconPositionicon-positionleft | right | undefinedleftSpecifies the horizontal position of the icon displayed in the button
label - string | undefinedThe label of the button
name - string | undefinedThe name sent with value to the form the button submits, as a native submit button does: buttons that submit the same form tell the receiver which one was chosen
size - lg | md | sm | xlmdSpecifies the size for the button
target - blank | selfselfSpecifies the target of the URL, if self or blank
tone - box | outline | strong | text | weak | undefinedstrongSpecifies the tone variant for the button
truncate - all | none | word | undefinedwordSpecifies if the text shoud be truncated or should behave as a normal text
type - a | button | reset | submit | undefinedsubmitThe type of the button element
value - string | undefinedThe value sent under name to the form the button submits
variant - ai | apple | dark | error | google | info | light | primary | secondary | success | warning | undefinedprimarySpecifies the color variant for the button
Slots
Slots take the content you write between the tags of the component. The default slot, the one without a name, accepts plain text, unless its description says otherwise. When the component has a label prop too, prefer the prop. Content for a named slot goes on a direct child with the name of the slot in its slot attribute, such as slot="notification".(default)Add text string to this slot, avoid to add HTML elements or components here.
No slot name
notificationAdd HTML elements or components, it is recommended to use mds-notification element.