/
githubmirror
/
tabler
Обзор
Документация
Войти
/
githubmirror
/
tabler
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
shared/ui/CardHeader.astro
21 строка
631 B
Paweł Kuna
Narrow component prop types, remove unused props and dead code (#2838)
10 авг 2026, 00:14
Не верифицирован
10 авг 2026, 00:14
4f7beec
Код
Авторство
О чём код?
--- import type { HTMLTag } from 'astro/types' // Card header (.card-header) with an optional h3.card-title; slot renders after the title. // `as` must stay out of the Props body: Astro's frontmatter scanner bails on a member // literally named `as` and silently falls back to untyped props. type PolymorphicProps = { as?: HTMLTag } interface Props extends PolymorphicProps { title?: string class?: string } const { title, as: TitleTag = 'h3', class: className }: Props = Astro.props --- <div class:list={['card-header', className]}> {title && <TitleTag class:list={['card-title']}>{title}</TitleTag>} <slot /> </div>