--- import DefaultLayout from '@shared/layouts/DefaultLayout.astro' import Card from '@ui/Card.astro' import CardBody from '@ui/CardBody.astro' import CardTitle from '@ui/CardTitle.astro' import CardSubtitle from '@ui/CardSubtitle.astro' import DocsLink from '@ui/DocsLink.astro' import Icon from '@ui/Icon.astro' import ImageLabel from '@ui/ImageLabel.astro' import { staticPath } from '@shared/lib/assets' const photo = (file: string) => staticPath(`photos/${file}`) const positions = [ { position: 'top-start', label: 'Top start' }, { position: 'top-end', label: 'Top end' }, { position: 'bottom-start', label: 'Bottom start' }, { position: 'bottom-end', label: 'Bottom end' }, ] as const const colors = ['primary', 'red', 'green', 'yellow'] const products = [ { name: 'Reading corner', price: '$129', file: 'book-on-the-grass.jpg', label: 'AI' }, { name: 'Designer sofa', price: '$849', file: 'blue-sofa-with-pillows-in-a-designer-living-room-interior.jpg', label: 'New' }, { name: 'Bedside stool', price: '$59', file: 'books-and-purple-flowers-on-a-wooden-stool-by-the-bed.jpg', label: '-20%', color: 'red' }, ] ---
Basic Wrap the image in .img-labeled and add an .img-label next to it.
A book on the grass AI
With an icon A label can hold an icon, a text, or both. Add .img-label-icon to a label with only an icon.
A brainstorming session 1:24
A woman using a laptop Premium
Colors Add a background utility such as .bg-red with its .text-red-fg.
{ colors.map((color) => (
A visit to the bookstore New
)) }
Position Move the label to another corner with .img-label-top-start, .img-label-top-end or .img-label-bottom-start.
{ positions.map((item) => (
A woman working on a laptop {item.label}
)) }
Multiple labels Put several labels on one image, each in its own corner.
Designers at a brainstorming session Live Members 4K
In a list Labels mark single items in a list of products or media.
{ products.map((product) => (
{product.name} {product.label}
{product.name}
{product.price}
)) }