Cards contain content and actions about a single subject.
Below you can view various demos with example markup.
The alert component comes with three variants: filled, outlined, and standard (default).
<.card>
<.card_content>
<.typography color="slate" margin={false} extend_class="mb-6">
Word of the Day
</.typography>
<.typography variant="h2" element="div" margin={false}>
be•nev•o•lent
</.typography>
<.typography color="slate">
adjective
</.typography>
<.typography variant="p" margin={false}>
well meaning and kindly.
<br />
"a benevolent smile"
</.typography>
</.card_content>
<.card_action>
<.button variant="text" size="sm">Learn More</.button>
</.card_action>
</.card>
Word of the Day
adjective
well meaning and kindly.
"a benevolent smile"
The alert component comes with three variants: filled, outlined, and standard (default).
<.card variant="outlined">
<.card_content>
<.typography color="slate" margin={false} extend_class="mb-6">
Word of the Day
</.typography>
<.typography variant="h2" element="div" margin={false}>
be•nev•o•lent
</.typography>
<.typography color="slate">
adjective
</.typography>
<.typography variant="p" margin={false}>
well meaning and kindly.
<br />
"a benevolent smile"
</.typography>
</.card_content>
<.card_action>
<.button variant="text" size="sm">Learn More</.button>
</.card_action>
</.card>
Word of the Day
adjective
well meaning and kindly.
"a benevolent smile"
The alert component comes with three variants: filled, outlined, and standard (default).
<.card extend_class="max-w-sm">
<.card_media
alt="maui hawaii"
src={@media_src}
extend_class="h-56"
/>
<.card_content>
<.typography variant="h3" margin={false} align="left" extend_class="mb-4">
Lorem ipsum
</.typography>
<.typography variant="p" margin={false} align="left">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</.typography>
</.card_content>
<.card_action extend_class="flex items-center">
<.button color="blue" variant="text">
Share
</.button>
<.button color="blue" variant="text">
Learn More
</.button>
</.card_action>
</.card>
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
The alert component comes with three variants: filled, outlined, and standard (default).
<.card extend_class="max-w-md">
<.card_header>
<:avatar src={@avatar_src}/>
<:title>
John Doe <b>@johndoe</b>
</:title>
<:subtitle>
6 hours ago
</:subtitle>
<:action>
<.button color="slate" variant="icon">
<.heroicon name="dots-vertical" variant="outline"/>
</.button>
</:action>
</.card_header>
<.card_media
alt="maui hawaii"
src={@media_src}
extend_class="h-56"
/>
<.card_content>
<.typography variant="p" margin={false} align="left">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
</.typography>
</.card_content>
<.card_action extend_class="flex items-center">
<.button color="slate" variant="icon">
<.heroicon name="heart" variant="outline"/>
</.button>
<.button color="slate" variant="icon">
<.heroicon name="chat" variant="outline"/>
</.button>
<div class="flex-1"></div>
<.button color="slate" variant="icon">
<.heroicon name="share" variant="outline"/>
</.button>
</.card_action>
</.card>
6 hours ago
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
API documentation for the component. Learn about imports and available attributes.
There are multiple ways to import components.
# PhoenixUI macro which imports all components
use PhoenixUI
# Or import component individually
import PhoenixUI.Components.Card
Below is a list of attributes that can be applied to the component.
Name | Type | Default | Description |
---|---|---|---|
HTML attribute | any | Supports all HTML attributes. | |
extend_class | string | Adds additional classes. | |
paper attributes | any | :inherit | Set the text-align on the component. |
phx-{any} | binding | Supports all Phoenix DOM element bindings. |
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 | slot | If set, adds action to header. | |
avatar | slot (avatar component) | If set, adds avatar to header. | |
extend_class | string | Adds additional classes. | |
phx-{any} | binding | Supports all Phoenix DOM element bindings. | |
subtitle | slot (typography component) | If set, adds subtitle to header. | |
title | slot (typography component) | If set, adds title to header. |
Below is a list of attributes that can be applied to the component.
Name | Type | Default | Description |
---|---|---|---|
HTML attribute | any | Supports all HTML attributes. | |
extend_class | string | Adds additional classes. | |
paper attributes | any | :inherit | Set the text-align on the component. |
phx-{any} | binding | Supports all Phoenix DOM element bindings. |
Below is a list of attributes that can be applied to the component.
Name | Type | Default | Description |
---|---|---|---|
HTML attribute | any | Supports all HTML attributes. | |
extend_class | string | Adds additional classes. | |
paper attributes | any | :inherit | Set the text-align on the component. |
phx-{any} | binding | Supports all Phoenix DOM element bindings. |
Below is a list of attributes that can be applied to the component.
Name | Type | Default | Description |
---|---|---|---|
HTML attribute | any | Supports all HTML attributes. | |
extend_class | string | Adds additional classes. | |
paper attributes | any | :inherit | Set the text-align on the component. |
phx-{any} | binding | Supports all Phoenix DOM element bindings. |