Card
A container component that displays content in a compact and organized way.
import { defineConfig } from '@pandacss/dev'
import { createPreset } from '@park-ui/panda-preset'
export default defineConfig({
preflight: true,
presets: [
'@pandacss/preset-base',
createPreset({
accentColor: '__ACCENT_COLOR__',
grayColor: '__GRAY_COLOR__',
borderRadius: '__BORDER_RADIUS__',
}),
],
include: ['./src/**/*.{js,jsx,ts,tsx}'],
jsxFramework: '__JS_FRAMEWORK__',
outdir: 'styled-system',
})
import { parkwindPlugin } from '@park-ui/tailwind-plugin'
import type { Config } from 'tailwindcss'
const config: Config = {
content: ['./src/**/*.{astro,html,js,jsx,svelte,ts,tsx,vue}'],
theme: {
extend: {},
},
plugins: [parkwindPlugin],
parkUI: {
accentColor: '__ACCENT_COLOR__',
grayColor: '__GRAY_COLOR__',
borderRadius: '__BORDER_RADIUS__',
},
darkMode: ['class'],
}
export default config
import { Stack } from 'styled-system/jsx'
import { Button } from '~/components/ui/button'
import * as Card from '~/components/ui/card'
import { FormLabel } from '~/components/ui/form-label'
import { Input } from '~/components/ui/input'
export const Demo = (props: Card.RootProps) => {
return (
<Card.Root width="sm" {...props}>
<Card.Header>
<Card.Title>Team Members</Card.Title>
<Card.Description>Add new members to your organisation.</Card.Description>
</Card.Header>
<Card.Body>
<Stack gap="4">
<Stack gap="1.5">
<FormLabel htmlFor="name">Name</FormLabel>
<Input id="name" placeholder="Name" />
</Stack>
<Stack gap="1.5">
<FormLabel htmlFor="email">Email</FormLabel>
<Input id="email" type="email" placeholder="Email" />
</Stack>
</Stack>
</Card.Body>
<Card.Footer gap="3">
<Button variant="outline">Cancel</Button>
<Button>Invite</Button>
</Card.Footer>
</Card.Root>
)
}
Insert code snippet into your project. Update import paths as needed.
import { ark } from '@ark-ui/react/factory'
import type { ComponentProps } from 'react'
import { tv } from 'tailwind-variants'
import { createStyleContext } from '~/lib/create-style-context'
const styles = tv(
{
base: 'card',
slots: {
root: 'card__root',
header: 'card__header',
body: 'card__body',
footer: 'card__footer',
title: 'card__title',
description: 'card__description',
},
variants: {},
},
{ twMerge: false },
)
const { withProvider, withContext } = createStyleContext(styles)
export const Root = withProvider(ark.div, 'root')
export const Body = withContext(ark.div, 'body')
export const Description = withContext(ark.div, 'description')
export const Footer = withContext(ark.div, 'footer')
export const Header = withContext(ark.div, 'header')
export const Title = withContext(ark.h3, 'title')
export type RootProps = ComponentProps<typeof Root>
export interface BodyProps extends ComponentProps<typeof Body> {}
export interface DescriptionProps extends ComponentProps<typeof Description> {}
export interface FooterProps extends ComponentProps<typeof Footer> {}
export interface HeaderProps extends ComponentProps<typeof Header> {}
export interface TitleProps extends ComponentProps<typeof Title> {}
import { ark } from '@ark-ui/solid'
import type { ComponentProps } from 'solid-js'
import { tv } from 'tailwind-variants'
import { createStyleContext } from '~/lib/create-style-context'
const styles = tv(
{
base: 'card',
slots: {
root: 'card__root',
header: 'card__header',
body: 'card__body',
footer: 'card__footer',
title: 'card__title',
description: 'card__description',
},
variants: {},
},
{ twMerge: false },
)
const { withProvider, withContext } = createStyleContext(styles)
export const Root = withProvider(ark.div, 'root')
export const Body = withContext(ark.div, 'body')
export const Description = withContext(ark.div, 'description')
export const Footer = withContext(ark.div, 'footer')
export const Header = withContext(ark.div, 'header')
export const Title = withContext(ark.h3, 'title')
export type RootProps = ComponentProps<typeof Root>
export interface BodyProps extends ComponentProps<typeof Body> {}
export interface DescriptionProps extends ComponentProps<typeof Description> {}
export interface FooterProps extends ComponentProps<typeof Footer> {}
export interface HeaderProps extends ComponentProps<typeof Header> {}
export interface TitleProps extends ComponentProps<typeof Title> {}
Not yet available