mirror of
https://github.com/tabler/tabler.git
synced 2026-10-12 05:06:55 +04:00
23 lines
698 B
Plaintext
23 lines
698 B
Plaintext
---
|
|
import type { HTMLTag } from 'astro/types'
|
|
|
|
// Card header (.card-header) with an optional h2.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
|
|
}
|
|
|
|
// h2 to match CardTitle — cards sit directly under the page h1.
|
|
const { title, as: TitleTag = 'h2', class: className }: Props = Astro.props
|
|
---
|
|
|
|
<div class:list={['card-header', className]}>
|
|
{title && <TitleTag class:list={['card-title']}>{title}</TitleTag>}
|
|
<slot />
|
|
</div>
|