Invoke is a leading creative engine that uses image and video generation models to empower professionals, artists, and enthusiasts to generate and create visual media using the latest AI-driven technologies. The solution offers an industry-leading application interface, and serves as the foundation for multiple commercial products.
TypeScript ai-artartificial-intelligencegenerative-artimage-generationimg2imginpaintinglatent-diffusionlinuxmacosoutpaintingstable-diffusiontxt2imgwindows
---
/*
* The home page's model families as a grid of link cards, with the external providers below. The section heading goes
* in the slot, so it shares the grid's width and left edge. Cards follow the site's link-card recipe. A card shows its
* family's cover, `src/assets/model-families/<slug>.webp`, above the text when that file exists, and is text only
* otherwise. Cards in a row stretch to the tallest and keep their text at the bottom, so text lines up across a row
* that mixes cards with and without covers.
*/
import ArrowRight from '@lucide/astro/icons/arrow-right';
import type { ImageMetadata } from 'astro';
import { Image } from 'astro:assets';
import { externalProviders, modelFamilies, type Label } from '../../config/model-families';
import { withBase } from '../base-path';
import Trans from './Trans.astro';
const base = import.meta.env.BASE_URL;
const { t } = Astro.locals;
const label = (value: Label) => (typeof value === 'string' ? value : t(value.labelKey));
const covers = import.meta.glob<ImageMetadata>('../../assets/model-families/*.webp', { eager: true, import: 'default' });
const coverFor = (slug: string) => covers[`../../assets/model-families/${slug}.webp`];
---
<div class="models">
<slot />
<ul class="grid" role="list">
{
modelFamilies.map(({ slug, name, link, kind, license, vram, formats }) => {
const cover = coverFor(slug);
return (
<li>
<a
class="card"
href={withBase(link, base)}
aria-labelledby={`model-${slug}`}
aria-describedby={`model-${slug}-tagline`}
>
{cover && (
<Image
class="cover"
src={cover}
alt=""
widths={[400, 640, 960]}
sizes="(min-width: 84rem) 20rem, (min-width: 48rem) 34vw, (min-width: 32rem) 50vw, 100vw"
/>
)}
<span class="body">
<span class="title">
<span class="name" id={`model-${slug}`}>
{name}
</span>
{kind === 'video' && <span class="tag tag--video">{t('modelFamilies.videoTag')}</span>}
<ArrowRight class="arrow" size={16} aria-hidden="true" />
</span>
<span class="tagline" id={`model-${slug}-tagline`}>
{t(`modelFamilies.${slug}.tagline`)}
</span>
<span class="tags">
<span class:list={['tag', `tag--${license.kind}`]}>
<Trans
message={t('modelFamilies.licenseTag', {
license: label(license.label),
interpolation: { escapeValue: false },
})}
>
{(text: string) => <span class="sr-only">{text}</span>}
</Trans>
</span>
{vram !== undefined && (
<span class="tag tag--plain">
<Trans message={t('modelFamilies.vramTag', { gigabytes: vram })}>
{(text: string) => <span class="sr-only">{text}</span>}
</Trans>
</span>
)}
{formats.map((format) => (
<span class="tag tag--plain">{label(format)}</span>
))}
</span>
</span>
</a>
</li>
);
})
}
</ul>
<div class="external">
<p class="external__label" id="home-models-external">{t('modelFamilies.externalProviders')}</p>
<ul class="external__links" role="list" aria-labelledby="home-models-external">
{
externalProviders.map(({ name, link }) => (
<li>
<a href={withBase(link, base)}>{name}</a>
</li>
))
}
</ul>
</div>
</div>
<style>
/* As wide as the What's new bento: up to 80rem, centred, inside the page gutters. */
.models {
--models-width: min(100vw - 2 * var(--sl-content-pad-x), 80rem);
container: models / inline-size;
display: flex;
flex-direction: column;
gap: 2rem;
width: var(--models-width);
margin-inline: calc((100% - var(--models-width)) / 2);
}
ul {
margin: 0;
padding: 0;
list-style: none;
}
.grid {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 1rem;
}
@container models (min-width: 28rem) {
.grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@container models (min-width: 44rem) {
.grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@container models (min-width: 64rem) {
.grid {
grid-template-columns: repeat(4, minmax(0, 1fr));
}
}
/* Stretched to the row's tallest card, with the text at the bottom. */
.card {
display: flex;
flex-direction: column;
justify-content: flex-end;
height: 100%;
overflow: hidden;
border: 1px solid var(--docs-border);
border-radius: var(--docs-radius-container);
background-color: var(--docs-surface);
color: var(--docs-text-strong);
text-decoration: none;
transition:
border-color 150ms ease,
background-color 150ms ease;
&:is(:hover, :focus-visible) {
border-color: var(--docs-border-strong);
background-color: var(--docs-control);
color: var(--docs-text-strong);
}
&:focus-visible {
outline: 2px solid var(--docs-accent);
outline-offset: 2px;
}
}
/* Covers are cropped to a wide frame above the text. */
.cover {
display: block;
flex: none;
width: 100%;
height: auto;
aspect-ratio: 16 / 9;
margin-bottom: auto;
border-bottom: 1px solid var(--docs-border);
object-fit: cover;
object-position: center;
}
.body {
display: flex;
flex-direction: column;
gap: 0.25rem;
padding: 1rem;
}
.title {
display: flex;
align-items: center;
gap: 0.5rem;
}
.name {
min-width: 0;
overflow: hidden;
font-size: 1rem;
font-weight: 600;
letter-spacing: -0.01em;
line-height: 1.35;
text-overflow: ellipsis;
white-space: nowrap;
}
.arrow {
flex-shrink: 0;
margin-inline-start: auto;
color: var(--docs-text-subtle);
transition: color 150ms ease;
}
.card:is(:hover, :focus-visible) .arrow {
color: var(--docs-text-strong);
}
.tagline {
overflow: hidden;
color: var(--docs-text-muted);
font-size: 0.8125rem;
line-height: 1.45;
text-overflow: ellipsis;
white-space: nowrap;
}
/* One line of tags; a row too long for the card fades out over its last 2.5rem, to nothing at the edge. */
.tags {
display: flex;
gap: 0.375rem;
margin-top: 0.5rem;
overflow: hidden;
mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
}
.tag {
flex: none;
padding: 0.125rem 0.375rem;
border-radius: var(--docs-radius);
font-size: 0.6875rem;
font-weight: 600;
letter-spacing: 0.02em;
line-height: 1.4;
white-space: nowrap;
}
.tag--open {
--tag: var(--invoke-success);
}
.tag--community {
--tag: var(--docs-accent);
}
.tag--noncommercial,
.tag--research,
.tag--restricted {
--tag: var(--invoke-warning);
}
.tag:not(.tag--plain, .tag--mixed, .tag--video) {
background-color: color-mix(in oklab, var(--tag) 14%, transparent);
color: var(--tag);
}
/* Not a license, so outlined rather than filled. */
.tag--video {
border: 1px solid var(--docs-border-strong);
color: var(--docs-text-muted);
}
.tag--plain,
.tag--mixed {
background-color: var(--docs-control);
color: var(--docs-text-muted);
}
/* External providers */
.external {
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 0.75rem 1rem;
}
.external__label {
margin: 0;
color: var(--docs-text-subtle);
font-size: 0.8125rem;
}
.external__links {
display: flex;
flex-wrap: wrap;
gap: 0.5rem;
a {
display: block;
padding: 0.375rem 0.75rem;
border: 1px solid var(--docs-border);
border-radius: var(--docs-radius);
background-color: var(--docs-surface);
color: var(--docs-text-strong);
font-size: 0.8125rem;
font-weight: 500;
line-height: 1.4;
text-decoration: none;
transition:
border-color 150ms ease,
background-color 150ms ease;
&:hover {
border-color: var(--docs-border-strong);
background-color: var(--docs-control);
color: var(--docs-text-strong);
}
&:focus-visible {
outline: 2px solid var(--docs-accent);
outline-offset: 2px;
}
}
}
</style>