Button
v0.0.10
mix mishka.ui.gen.component button
Base color & variant
Base color & variant
<.button>Base</.button>Radius prop
With the Mishka Chelekom button component, you can customize the button's border radius using different size options. Available sizes include extra_small, small, medium, large, extra_large, full, and none, allowing you to adjust the roundness of the button’s corners to fit your design needs. Whether you prefer sharp edges or fully rounded buttons, these options offer flexibility for any interface.
Radius prop
<.button rounded="extra_small">Extra Small</.button>
<.button rounded="small">Small</.button>
<.button rounded="medium">Medium</.button>
<.button rounded="large">Large</.button>
<.button rounded="extra_large">Extra Large</.button>Size prop
The size prop in the Mishka Chelekom button controls padding and text size. When circle is false, it uses padding based on the size (extra_small to extra_large). If circle is true, it applies Tailwind size classes for circular buttons. It also adjusts the indicator and text size accordingly.
Size prop
<.button size="extra_small">Extra Small</.button>
<.button size="small">Small</.button>
<.button size="medium">Medium</.button>
<.button size="large">Large</.button>
<.button size="extra_large">Extra Large</.button>Icon prop
The icon prop allows you to display an icon alongside an item, using LiveView Hero Icons by default. The icon_class prop enables custom classes for styling the icon. By default, the icon is positioned on the left, but the right_icon and left_icon props allow you to control the icon’s position inside the button.
Icon prop
<.button icon="hero-bookmark" icon_class="size-4" aria-label="Bookmark" />
<.button icon="hero-plus">Button</.button>
<.button icon="hero-bell">Button</.button>
<.button icon="hero-magnifying-glass-circle-solid">Button</.button>
<.button icon="hero-play">Button</.button>Circle Prop
The circle prop ensures the button has equal width and height, which can be used to create either circular shapes or square buttons. This prop is perfect for situations where you want a consistent, symmetrical design, making it ideal for icon buttons or other elements that require uniform dimensions.
Circle Prop
<.button circle size="extra_small">Extra Small Button</.button>
<.button circle size="small">Small Button</.button>
<.button circle size="medium">Medium Button</.button>
<.button circle size="large">Large Button</.button>
<.button circle size="extra_large">Extra Large Button</.button>
<.button circle rounded="full" size="extra_large">
Extra Large Button
</.button>Full width
The full_width prop change width of button to is a boolean change width of button to 100%
Full width
<.button size="extra_small" full_width>Natural</.button>Loading slot
The loading slot requires a position attribute, which must be set to either start or end. This allows developers to add custom content or components to represent the loading process. For example, users can utilize the spinner component from Mishka Chelekom in any color and size they desire, ensuring a seamless and customizable user experience. If user not specify position the start is the default position of loader.
<.button>
<:loading>
<.spinner />
</:loading>
</.button>
<.button variant="outline" color="dawn">
<:loading position="end">
<.spinner />
</:loading>
</.button>
<.button_link navigate="/" variant="inverted" color="misc">
<:loading position="end">
<.spinner />
</:loading>
</.button_link>Attributes
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
id
|
string
| — | — | No | A unique identifier is used to manage state and interaction |
variant
|
string
|
base
|
basedefaultoutlinetransparentsubtleshadowinvertedbordereddefault_gradientoutline_gradientinverted_gradient
| No | Determines the style |
type
|
any
| — |
buttonsubmitreset
| No | Specifies the type of the element |
color
|
string
|
base
|
basenaturalwhitedarkprimarysecondarysuccesswarningdangerinfosilvermiscdawntransparent
| No | Determines color theme |
rounded
|
string
|
large
|
extra_smallsmallmediumlargeextra_largefullnone
| No | Determines the border radius |
border
|
string
|
extra_small
| — | No | Determines border style |
size
|
string
|
large
|
extra_smallsmallmediumlargeextra_largefull
| No | Determines the overall size of the elements, including padding, font size, and other items |
content_position
|
string
|
center
| — | No | Determines the alignment of the element's content |
display
|
string
|
inline-flex
| — | No | Specifies the CSS display property for the element |
line_height
|
string
|
leading-5
| — | No | Line height |
icon
|
string
| — | — | No | Icon displayed alongside of an item |
icon_class
|
string
| — | — | No | Determines custom class for the icon |
font_weight
|
string
|
font-normal
| — | No | Determines custom class for the font weight |
full_width
|
boolean
|
false
| — | No | Make button full width |
indicator_class
|
string
| — | — | No | Custom CSS class for styling the indicator element |
indicator_size
|
string
|
extra_small
| — | No | Defines the size of the indicator element |
class
|
any
| — | — | No | Custom CSS class for additional styling |
content_class
|
string
|
block
| — | No | Custom CSS class for additional styling |
rest
|
global
| — | — | No | Global attributes can define defaults which are merged with attributes provided by the caller |
Slots
| Name | Required | Description |
|---|---|---|
inner_block
| No | Inner block that renders HEEx content |
loading
| No | — |
Attributes of the loading slot
| Name | Type | Default | Values | Required | Description |
|---|---|---|---|---|---|
class
|
any
| — | — | No | Custom CSS class for additional styling |
position
|
string
| — |
startend
| No | Determines the element position |
Options
Each option takes one or more of its values, separated by commas.
| Option | Values |
|---|---|
--variant
|
basedefaultoutlinetransparentsubtleshadowinvertedbordereddefault_gradientoutline_gradientinverted_gradient
|
--color
|
basenaturalwhitedarkprimarysecondarysuccesswarningdangerinfosilvermiscdawntransparent
|
--size
|
extra_smallsmallmediumlargeextra_largefull
|
--rounded
|
extra_smallsmallmediumlargeextra_largefullnone
|
--type
|
button_groupbuttoninput_buttonbutton_linkback
|
--module
| A module name of your own |
What it generates
mix mishka.ui.gen.component button