Phoenix UI

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

Checkbox

Checkboxes allow the user to select one or more items from a set.

Checkboxes can be used to turn an option on or off.

If you have multiple options appearing in a list, you can preserve space by using checkboxes instead of on/off switches. If you have a single option, avoid using a checkbox and use an on/off switch instead.

Examples

Below you can view various demos with example markup.

Basic Checkboxes

Severity

The alert component comes with four severities: error, warning, info (default), and success.

Title

You can use the :title slot to display a formatted title above the content.

Action

An alert can have an action, such as a close or undo button. It is rendered after the message, at the end of the alert.

If action phx-click or other Heroicon-specific attributes are set, a close icon is displayed. The action can be used as a slot to provide an alternative action, for example using a Button.

Icon

The icon prop allows you to add an icon to the beginning of the alert component. This will override the default icon for the specified severity.

Setting the icon to false will remove the icon altogether.

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.Alert, only: [alert: 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.
action heroicon attrs | slot
content* inner_block | slot | string
extend_class string Adds additional classes.
icon heroicon attrs | slot []
phx-{any} binding Supports all Phoenix DOM element bindings.
severity string info
title string | slot
variant "filled" | "outlined" | "standard" standard