v2.1.8
  • Get Started
  • Components
  • Composables
  • Typography
  • GitHub
  • Overview
  • Introduction
  • Headers and text
  • Lists and tables
  • Images and embeds
  • Code
  • Components
  • Accordion
  • Badge
  • Callout
  • Card
  • CardGroup
  • CodeCollapse
  • CodeGroup
  • CodePreview
  • Collapsible
  • Field
  • FieldGroup
  • Kbd
  • Steps
  • Tabs
  • b24icons
  • b24jssdk
Use our Nuxt starter
v2.1.8
  • Docs
  • Components
  • Composables
  • Typography

Card

Develop prominent content areas with integrated navigation options.
GitHub
Nuxt UI

Usage

Use markdown in the default slot of the card component to highlight your content.

Use the title, icon and color props to customize it. You can also pass any property from the <NuxtLink> component.

Startup

Best suited for small teams, startups and agencies with up to 5 developers.
{
  "wait": "Loading client-side content..."
}

API

Props

Prop Default Type
to string | RouteLocationAsRelativeGeneric | RouteLocationAsPathGeneric
  • name?: RouteRecordNameGeneric
  • params?: RouteParamsRawGeneric
  • path?: undefined

    A relative path to the current location. This property should be removed

  • query?: LocationQueryRaw
  • hash?: string
  • force?: boolean

    Triggers the navigation even if the location is the same as the current one. Note this will also add a new entry to the history unless replace: true is passed.

  • state?: HistoryState

    State to save using the History API. This cannot contain any reactive values and some primitives like Symbols are forbidden. More info at https://developer.mozilla.org/en-US/docs/Web/API/History/state

target null | "_blank" | "_parent" | "_self" | "_top" | string & {}
iconIconComponent
title string
description string
color'air-primary'"air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-warning" | "air-primary-copilot" | "air-secondary" | "air-secondary-alert" | "air-secondary-accent" | "air-secondary-accent-1" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary"
b24ui { base?: ClassNameValue; icon?: ClassNameValue; title?: ClassNameValue; description?: ClassNameValue; externalIcon?: ClassNameValue; }

Slots

Slot Type
default{}
title{}

Theme

app.config.ts
export default defineAppConfig({
  b24ui: {
    prose: {
      card: {
        slots: {
          base: 'group relative block my-5 p-4 sm:p-6 text-(--b24ui-color) border border-(--ui-color-design-tinted-na-stroke) bg-(--b24ui-background) rounded-md transition-colors',
          icon: 'size-6 mb-2 block text-(--b24ui-icon)',
          title: 'text-(--b24ui-color) font-semibold',
          description: 'text-[15px] text-(--b24ui-color) [&_p]:text-(--b24ui-color) *:first:mt-0 *:last:mb-0 *:my-1',
          externalIcon: 'size-4 align-top absolute right-2 top-2 pointer-events-none text-(--b24ui-split-divider-color) transition-colors'
        },
        variants: {
          color: {
            'air-primary': {
              base: 'style-filled'
            },
            'air-primary-success': {
              base: 'style-filled-success'
            },
            'air-primary-alert': {
              base: 'style-filled-alert'
            },
            'air-primary-copilot': {
              base: 'style-filled-copilot'
            },
            'air-primary-warning': {
              base: 'style-filled-warning'
            },
            'air-secondary': {
              base: 'style-tinted'
            },
            'air-secondary-alert': {
              base: 'style-tinted-alert'
            },
            'air-secondary-accent': {
              base: 'style-tinted-no-accent-1'
            },
            'air-secondary-accent-1': {
              base: 'style-outline-accent-1'
            },
            'air-secondary-accent-2': {
              base: 'style-outline-accent-2'
            },
            'air-secondary-no-accent': {
              base: 'style-outline'
            },
            'air-tertiary': {
              base: 'style-outline-no-accent'
            }
          },
          to: {
            true: ''
          },
          title: {
            true: {
              description: 'mt-1'
            }
          }
        },
        compoundVariants: [
          {
            to: true,
            class: {
              base: 'hover:bg-(--ui-color-bg-content-secondary) hover:border-(--b24ui-border-color-hover)',
              title: 'group-hover:text-(--b24ui-border-color)',
              description: 'group-hover:text-(--b24ui-border-color) [&_p]:group-hover:text-(--b24ui-border-color)',
              externalIcon: 'group-hover:text-(--b24ui-icon)'
            }
          }
        ],
        defaultVariants: {
          color: 'air-primary'
        }
      }
    }
  }
})
vite.config.ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import bitrix24UIPluginVite from '@bitrix24/b24ui-nuxt/vite'

export default defineConfig({
  plugins: [
    vue(),
    bitrix24UIPluginVite({
      b24ui: {
        prose: {
          card: {
            slots: {
              base: 'group relative block my-5 p-4 sm:p-6 text-(--b24ui-color) border border-(--ui-color-design-tinted-na-stroke) bg-(--b24ui-background) rounded-md transition-colors',
              icon: 'size-6 mb-2 block text-(--b24ui-icon)',
              title: 'text-(--b24ui-color) font-semibold',
              description: 'text-[15px] text-(--b24ui-color) [&_p]:text-(--b24ui-color) *:first:mt-0 *:last:mb-0 *:my-1',
              externalIcon: 'size-4 align-top absolute right-2 top-2 pointer-events-none text-(--b24ui-split-divider-color) transition-colors'
            },
            variants: {
              color: {
                'air-primary': {
                  base: 'style-filled'
                },
                'air-primary-success': {
                  base: 'style-filled-success'
                },
                'air-primary-alert': {
                  base: 'style-filled-alert'
                },
                'air-primary-copilot': {
                  base: 'style-filled-copilot'
                },
                'air-primary-warning': {
                  base: 'style-filled-warning'
                },
                'air-secondary': {
                  base: 'style-tinted'
                },
                'air-secondary-alert': {
                  base: 'style-tinted-alert'
                },
                'air-secondary-accent': {
                  base: 'style-tinted-no-accent-1'
                },
                'air-secondary-accent-1': {
                  base: 'style-outline-accent-1'
                },
                'air-secondary-accent-2': {
                  base: 'style-outline-accent-2'
                },
                'air-secondary-no-accent': {
                  base: 'style-outline'
                },
                'air-tertiary': {
                  base: 'style-outline-no-accent'
                }
              },
              to: {
                true: ''
              },
              title: {
                true: {
                  description: 'mt-1'
                }
              }
            },
            compoundVariants: [
              {
                to: true,
                class: {
                  base: 'hover:bg-(--ui-color-bg-content-secondary) hover:border-(--b24ui-border-color-hover)',
                  title: 'group-hover:text-(--b24ui-border-color)',
                  description: 'group-hover:text-(--b24ui-border-color) [&_p]:group-hover:text-(--b24ui-border-color)',
                  externalIcon: 'group-hover:text-(--b24ui-icon)'
                }
              }
            ],
            defaultVariants: {
              color: 'air-primary'
            }
          }
        }
      }
    })
  ]
})
Some colors in compoundVariants are omitted for readability. Check out the source code on GitHub.

Callout

Organize critical content for easy scanning with colored panels and intuitive symbols.

CardGroup

Arrange content cards into flexible grids to enhance structure and readability.

On this page

  • Usage
  • API
    • Props
    • Slots
  • Theme
Releases
Published under MIT License.

Copyright © 2024-present Bitrix24