Phoenix UI

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

Chip

Chips are compact elements that represent an input, attribute, or action. Chips allow users to enter information, make selections, filter content, or trigger actions.

While included here as a standalone component, the most common use will be in some form of input, so some of the behavior demonstrated here is not shown in context.

Examples

Below you can view various implementations and example markup.

Variant

The chip component supports outlined and filled styling.

filled
outlined

Clickable

Chips with the on_click prop defined change appearance on focus, hover, and click.

clickable
clickable

Deletable

Chips with the onDelete prop defined will display a delete icon which changes appearance on hover.

deletable
deletable

Clickable & Deletable

Chips with the onDelete prop defined will display a delete icon which changes appearance on hover.

clickable deletable
clickable deletable

Chips with the onDelete prop defined will display a delete icon which changes appearance on hover.

Custom Delete Icon

Chips with the onDelete prop defined will display a delete icon which changes appearance on hover.

custom delete icon
custom delete icon

Avatar

Use the avatar prop to add an avatar.

avatar
Inara Mosley
avatar

Icon

Use the icon attribute to add an icon.

icon
icon

Color

You can use the color attribute to define a color from theme palette.

red
orange
yellow
green
blue
purple
red
orange
yellow
green
blue
purple

Size

You can use the size prop to define a small Chip.

small
small

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
    

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 slate Any Tailwind-supported color.
extend_class string Adds additional classes.
phx-{any} binding Supports all Phoenix DOM element bindings.
size "sm" | "md" md
variant "filled" | "outlined" filled