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

Collapsible

Smooth content toggle with expand and collapse effects.
GitHub
Nuxt UI

Usage

Wrap your content with the collapsible component to display a Collapsible in your content.

PropDefaultType
namestring
sizemdstring
colorneutralstring
::collapsible

| Prop    | Default   | Type                     |
|---------|-----------|--------------------------|
| `name`  |           | `string`{lang="ts-type"} |
| `size`  | `md`      | `string`{lang="ts-type"} |
| `color` | `neutral` | `string`{lang="ts-type"} |

::

API

Props

Prop Default Type
iconicons.chevronDownIconComponent

The icon displayed to toggle the collapsible.

namet('prose.collapsible.name') string

The name displayed in the trigger label.

openTextt('prose.collapsible.openText') string

The text displayed when the collapsible is open.

closeTextt('prose.collapsible.closeText') string

The text displayed when the collapsible is closed.

b24ui { root?: ClassNameValue; trigger?: ClassNameValue; triggerIcon?: ClassNameValue; triggerLabel?: ClassNameValue; content?: ClassNameValue; } & { root?: ClassNameValue; content?: ClassNameValue; }
  • root?: ClassNameValue
  • trigger?: ClassNameValue
  • triggerIcon?: ClassNameValue
  • triggerLabel?: ClassNameValue
  • content?: ClassNameValue

Slots

Slot Type
default{}

Theme

app.config.ts
export default defineAppConfig({
  b24ui: {
    prose: {
      collapsible: {
        slots: {
          root: 'my-[20px]',
          trigger: 'group relative rounded-(--ui-border-radius-md) inline-flex items-center gap-[4px] text-(--b24ui-typography-description-color) hover:text-(--b24ui-typography-label-color) text-(length:--ui-font-size-3xs) leading-(--ui-font-line-height-2xs) focus-visible:ring-2 focus-visible:ring-(--ui-color-design-selection-stroke) focus:outline-none cursor-pointer transition-colors',
          triggerIcon: 'size-[14px] shrink-0 motion-safe:group-data-[state=open]:rotate-180 transition-transform duration-200',
          triggerLabel: 'truncate',
          content: '*:first:mt-2.5 *:last:mb-0 *:my-1.5'
        }
      }
    }
  }
})
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: {
          collapsible: {
            slots: {
              root: 'my-[20px]',
              trigger: 'group relative rounded-(--ui-border-radius-md) inline-flex items-center gap-[4px] text-(--b24ui-typography-description-color) hover:text-(--b24ui-typography-label-color) text-(length:--ui-font-size-3xs) leading-(--ui-font-line-height-2xs) focus-visible:ring-2 focus-visible:ring-(--ui-color-design-selection-stroke) focus:outline-none cursor-pointer transition-colors',
              triggerIcon: 'size-[14px] shrink-0 motion-safe:group-data-[state=open]:rotate-180 transition-transform duration-200',
              triggerLabel: 'truncate',
              content: '*:first:mt-2.5 *:last:mb-0 *:my-1.5'
            }
          }
        }
      }
    })
  ]
})

CodePreview

For clearer docs, pair code snippets with their visual output and source.

Field

Provide clear and comprehensive documentation for the API configurable elements.

On this page

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

Copyright © 2024-present Bitrix24