v2.15.0

ProseCodeCollapse

Сворачиваемые длинные блоки кода экономят место на странице.

Использование

Компонент code-collapse превращает блок кода в сворачиваемый.

app/assets/css/main.css
@import "tailwindcss";
@import "@bxshefby/b24ui-nuxt";

@theme static {
  --font-sans: 'Public Sans', sans-serif;

  --breakpoint-3xl: 1920px;

  --color-green-50: #EFFDF5;
}
::code-collapse

```css [app/assets/css/main.css]
@import "tailwindcss";
@import "@bxshefby/b24ui-nuxt";

@theme static {
  --font-sans: 'Public Sans', sans-serif;

  --breakpoint-3xl: 1920px;

  --color-green-50: #EFFDF5;
}
```

::

API

Пропсы

Prop Default Type
iconui.icons.chevronDownIconComponent

The icon displayed to toggle the code.

namet('prose.codeCollapse.name') string

The name displayed in the trigger label.

openTextt('prose.codeCollapse.openText') string

The text displayed when the code is collapsed.

closeTextt('prose.codeCollapse.closeText') string

The text displayed when the code is expanded.

openfalseboolean
b24ui { root?: SlotClass; footer?: SlotClass; trigger?: SlotClass; triggerIcon?: SlotClass; }

Слоты

Slot Type
default{}

Тема

https://github.com/bx-shef/b24-ui/tree/main/src/theme/code-collapse.ts
export default {
  slots: {
    root: 'relative my-5 bg-(--ui-color-design-outline-bg) [&>div]:my-0 [&_pre]:max-h-[80vh] [&_pre]:pb-[48px]',
    footer: 'h-[64px] absolute inset-x-px bottom-px rounded-b-(--ui-border-radius-md) flex items-center justify-center',
    trigger: 'group',
    triggerIcon: 'group-data-[state=open]:rotate-180'
  },
  variants: {
    open: {
      true: {
        root: 'rounded-(--ui-border-radius-md)'
      },
      false: {
        root: 'max-h-[200px] overflow-hidden rounded-b-(--ui-border-radius-md) [&_pre]:overflow-hidden',
        footer: 'inset-x-0 bottom-0 border border-t-0 border-(--ui-color-design-outline-stroke) bg-linear-to-t from-(--ui-color-g-plastic-greish-bg)'
      }
    }
  }
}