Button

Easily create nice looking buttons, which come in different styles.

Button

Easily create nice looking buttons, which come in different styles.

Usage

To apply this component, add the .uk-button class and a modifier such as .uk-button-default to an <a> or <button> element. Add the disabled attribute to a <button> element to disable the button.

<a class="uk-button uk-button-default" href=""></a>

<button class="uk-button uk-button-default"></button>

<button class="uk-button uk-button-default" disabled></button>

Note If you are displaying a number of buttons in a row, you can add a top margin to them, when they stack on smaller viewports. Just add the uk-margin attribute from the Margin component to their parent element.


Style modifiers

There are several style modifiers available. Just add one of the following classes to apply a different look.

ClassDescription
.uk-button-defaultDefault button style.
.uk-button-primaryIndicates the primary action.
.uk-button-secondaryIndicates an important action.
.uk-button-dangerIndicates a dangerous or negative action.
.uk-button-textApplies an typographic style.
.uk-button-linkApplies an plain link style.
<button class="uk-button uk-button-primary"></button>

Size modifiers

Add the .uk-button-small or .uk-button-large class to a button to make it smaller or larger.

<button class="uk-button uk-button-default uk-button-small"></button>

<button class="uk-button uk-button-default uk-button-large"></button>

Width modifiers

Add the .uk-width-1-1 class from the Width component and the button will take up full width.

Example


Group

To create a button group, add the .uk-button-group class to a <div> element around the buttons. That’s it! No further markup needed.

<div class="uk-button-group">
    <button class="uk-button uk-button-default"></button>
    <button class="uk-button uk-button-default"></button>
    <button class="uk-button uk-button-default"></button>
</div>

Button with dropdowns

A button can be used to trigger a dropdown menu from the Dropdown component.

<!-- A button toggling a dropdown -->
<button class="uk-button uk-button-default" type="button"></button>
<div uk-dropdown></div>

Button group with dropdowns

Use button groups to split buttons into a standard action on the left and a dropdown toggle on the right. Just wrap the toggling button and the drop or dropdown inside a <div> element and add the .uk-inline class from the Utility component.

<!-- A button group with a dropdown -->
<div class="uk-button-group">
    <button class="uk-button uk-button-default"></button>
    <div class="uk-inline">

        <!-- The button toggling the dropdown -->
        <button class="uk-button uk-button-default" type="button"></button>
        <div uk-dropdown="mode: click; target: !.uk-button-group;"></div>

    </div>
</div>