Cards and tiles

Components•3 min read|
|

Use cards and tiles to create navigation grids, feature highlights, and content previews.

Cards

Style a card's parts with ::part(): image, icon, title, content and cta. See Custom CSS.

Cards are clickable containers with an optional icon, image and title. The text inside the tags is the description:

<wc-card icon="book" title="Documentation" href="/0.3/getting-started/introduction"> Learn how to build beautiful documentation sites with DocsLit. </wc-card> Learn how to build beautiful documentation sites with DocsLit.

A card has no description attribute. The text between the tags is the description, and it can use Markdown. Without an href the card is a plain box.

The card heading. Inline Markdown works. The link destination: a page slug or an external URL. External links open in a new tab. An icon: a Lucide or Font Awesome name, an emoji, an image or inline SVG. icon-name is an older alias. The icon color, as any CSS color. The icon color in dark mode. icon-color is then the light-mode color. The size of the icon box in pixels. Where the icon sits: top or left. A compact horizontal layout, with the icon on the left. An image URL or path shown on the card. Where the image sits: top, left, right or bottom. Call-to-action text at the bottom of the card, with an arrow. true or false to show or hide the corner arrow. By default it shows for external links only. A callout-style color theme for the card: info, warning, note, tip, check or danger.

Card variations

<wc-tiles cols="2"> <wc-card title="Quickstart" icon="rocket" icon-color="#0d9488" href="/0.3/getting-started/quickstart" cta="Start now"> Go from zero to a live site in minutes. </wc-card> <wc-card title="Heads up" icon="triangle-alert" type="warning" horizontal> A horizontal card with a warning color. </wc-card> <wc-card title="GitHub" icon="fa-brands fa-github" href="/0.3/https://github.com/UmbrellaDocs/docslit-cli" arrow="true"> External cards show an arrow. </wc-card> <wc-card title="Always visible" icon="eye" icon-position="left" arrow="false"> A card with the icon on the left and no arrow. </wc-card> </wc-tiles> Go from zero to a live site in minutes. A horizontal card with a warning color. External cards show an arrow. A card with the icon on the left and no arrow.

Tiles

Tiles create a grid of linked items. Use wc-tiles as the container and wc-tile for each item:

<wc-tiles> <wc-tile icon="zap" title="Fast" description="Static builds with zero runtime overhead." href="/0.3/deployment/static-hosting"></wc-tile> <wc-tile icon="palette" title="Themeable" description="Six themes and thirteen palettes." href="/0.3/customization/theming"></wc-tile> <wc-tile icon="search" title="Searchable" description="Full-text search with no external service." href="/0.3/writing-content/search-and-seo"></wc-tile> <wc-tile icon="blocks" title="Components" description="Every component, with live examples." href="/0.3/components/callouts-and-alerts"></wc-tile> </wc-tiles>

A tile is compact by default. Put an image or an SVG inside it, with blank lines around, and it becomes a larger visual preview above the title:

<wc-tiles cols="2"> <wc-tile title="Dashboard" description="With a preview." href="/0.3/getting-started/introduction"> ![Dashboard preview](/assets/themes/peppermint-light.webp) </wc-tile> </wc-tiles> The tile heading. Inline Markdown works. A short description displayed below the title. The link destination. An icon displayed above the title. icon-name is an older alias. The number of columns in the grid. Defaults to automatic sizing. A wc-tiles can hold wc-tile or wc-card children.

Columns

wc-columns lays out arbitrary content in a grid when you do not need links. See Layout.

Buttons

Use buttons for prominent calls to action. They link when you give an href:

<wc-button href="/0.3/getting-started/quickstart" icon="rocket" right-icon="arrow-right">Get started</wc-button> <wc-button href="/0.3/getting-started/introduction" variant="outline">Learn more</wc-button> <wc-button href="/0.3/https://github.com/UmbrellaDocs/docslit-cli" variant="ghost" icon="fa-brands fa-github" target="_blank">View on GitHub</wc-button> <wc-button variant="success" rounded>Rounded</wc-button> <wc-button variant="primary" outlined size="sm">Small outlined</wc-button> <wc-button variant="warning" minimal mono>Mono minimal</wc-button> <wc-button variant="danger" disabled>Disabled</wc-button>

Get started Learn more View on GitHub Rounded Small outlined Mono minimal Disabled

The button text. When omitted, the text between the tags is used. The link destination. With an href, the button renders as a link. The color intent: primary, outline, ghost, danger, success, warning or none. The button size: sm, md or lg. The link target. _blank adds rel="noopener noreferrer". A transparent background with a colored border. A subtle tinted background and no border. A full-width button. Pill-shaped corners. A monospace label. Show the pressed ring. Disable the button. An icon before the label. An icon after the label.

When to use each

Component Best for
wc-card Single featured links with descriptions, images or a call to action
wc-tiles Navigation grids, feature overviews, landing pages
wc-button Primary calls to action, download links