Phoenix UI

Phoenix UI home page
  1. Getting Started
  2. Installation: Tailwind CLI

Button

Buttons allow users to take actions, and make choices, with a single tap.

Buttons communicate actions that users can take. They are typically placed throughout your UI, in places like Modal windows, forms, cards, toolbars, and more.

Examples

Below you can view various demos with example markup.

Variant

The button component supports contained, outlined, and text styling.

Color

The color attribute can be used to control the appearance of the button group.

Size

The size attribute can be used to control the appearance of the button.

Disabled

The disabled attribute can be used to control whether or not the button is disabled.

Icon

Icon buttons are commonly found in app bars and toolbars.

Icons are also appropriate for toggle buttons that allow a single choice to be selected or deselected, such as adding or removing a star to an item.

API

API documentation for the component. Learn about imports and available attributes.

Import

There are multiple ways to import components.


    # PhoenixUI macro which imports all components
    use PhoenixUI
    # Or import component individually
    import PhoenixUI.Components.Button, only: [button: 1]
    

Attributes

Below is a list of attributes that can be applied to the component.

Name Type Default Description
HTML attribute any Supports all HTML attributes.
color any tailwind color blue Any Tailwind-supported color.
disabled bool false If true, the component is disabled.
element any HTML element div HTML element to use.
extend_class string Adds additional classes.
phx-{any} binding Supports all Phoenix DOM element bindings.
size "xs" | "sm" | "md" | "lg" | "xl" md
square bool false if true, has square edges
variant "contained" | "outlined" | "text" contained