Skip to content
On this page

Card

Basic

Card component uses ATypography component for its typography.

Moreover, you can also use .card-body in default slot to render card content.

You can use .card-spacer helper class to add margin bottom to each of its children except last.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

Card text font size

If you pass text prop directly on ACard then ACard will add text-sm class before passing down it to ATypography. Hence, when you don't use text prop and manually write text as show in second card, for small text you have to add text-sm class.

This way if you want 16px font for your card text instead of 14px you can omit adding text-sm to p tag;

Adjusting card body padding

You can adjust the padding to applied by a-card-body using --a-card-padding CSS variable.

Adjusting card spacer margin

You can customize the applied margin-bottom by configuring --a-card-spacer CSS variable.

Various Elements

Mix and match the different components to achieve desired UI.

Card title

Chocolate cake tiramisu donut

girl

Macaroon cake powder pie cake cake gingerbread oat cake chocolate cake.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

minimal-3

Awesome mobile

Biscuit liquorice apple pie candy canes

Donut jelly beans cake lollipop sweet biscuit. Pie apple pie powder apple pie gummi bears. Jelly apple pie croissant candy canes liquorice halvah.

Variants

Card component uses layer composable as it's base. You can use variant prop to create various card variants.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

Slot

You can use ATypography slots to render custom content in header.

Card title

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

Card titleLink

Chocolate cake tiramisu donut

Ice cream sweet pie pie dessert sweet danish. Jelly jelly beans cupcake jelly-o chocolate bonbon chocolate bar.

TIP

Above demo adds content to the right of title. If you want to add content on the right of both title & subtitle use header-right slot.

API

Card

variant : LayerVariant

Layer variant

states : boolean

Interaction states like hover & active

loading : boolean | ALoaderProps

Set loading state

titleTag : string

Tag to use for title of the component

subtitleTag : string

Tag to use for subtitle of the component

textTag : string

Tag to use for text rendered via text prop

text : ConfigurableValue

Typography text content

color : ColorProp

Layer color

title : ConfigurableValue

Typography title

subtitle : ConfigurableValue

Typography subtitle

img : string

Render image at the top of the card (above header)

imgAlt : string

alt attribute for image rendered via img prop

default : any

Default slot for rendering card content

title : any

Render custom content for title

subtitle : any

Render custom content for subtitle

header-right : any

Render custom content on right side of title & subtitle. Content inside this slot will be vertically centered to title & subtitle.

Released under the MIT License.