Use the Accordion component to display a list of collapsible items.
Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
const items = ref<AccordionItem[]>([
{
label: 'Getting started with Bitrix24',
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
])
</script>
<template>
<B24Accordion :items="items" />
</template>
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
const items = ref<AccordionItem[]>([
{
label: 'Getting started with Bitrix24',
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
])
</script>
<template>
<B24Accordion :items="items" />
</template>
Set the type prop to multiple to allow multiple items to be active at the same time. Defaults to single.
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
const items = ref<AccordionItem[]>([
{
label: 'Getting started with Bitrix24',
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
])
</script>
<template>
<B24Accordion type="multiple" :items="items" />
</template>
When type is single, you can set the collapsible prop to false to prevent the active item from collapsing.
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
const items = ref<AccordionItem[]>([
{
label: 'Getting started with Bitrix24',
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
])
</script>
<template>
<B24Accordion :collapsible="false" :items="items" />
</template>
Use the unmount-on-hide prop to prevent the content from being unmounted when the accordion is collapsed. Defaults to true.
Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.
Bitrix24 is an online service that has all the tools for company operation and business management.
Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
const items = ref<AccordionItem[]>([
{
label: 'Getting started with Bitrix24',
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
])
</script>
<template>
<B24Accordion :unmount-on-hide="false" :items="items" />
</template>
You can inspect the DOM to see each item's content being rendered.
Use the disabled property to disable the Accordion.
You can also disable a specific item by using the disabled property in the item object.
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
const items = ref<AccordionItem[]>([
{
label: 'Getting started with Bitrix24',
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
])
</script>
<template>
<B24Accordion disabled :items="items" />
</template>
Use the trailing-icon prop to customize the trailing Icon of each item.
You can also set an icon for a specific item by using the trailingIcon property in the item object.
<script setup lang="ts">
import RocketIcon from '@bitrix24/b24icons-vue/main/RocketIcon'
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
const items = ref<AccordionItem[]>([
{
label: 'Icons',
content: 'You have nothing to do, @nuxt/icon will handle it automatically.'
},
{
label: 'Colors',
content: 'Choose a primary and a neutral color from your Tailwind CSS theme.'
},
{
label: 'Components',
content: 'You can customize components by using the `class` / `ui` props or in your app.config.ts.'
}
])
</script>
<template>
<B24Accordion :trailing-icon="RocketIcon" :items="items" />
</template>
You can control the active item by using the default-value prop or the v-model directive with the value of the item. If no value is provided, it defaults to the index as a string.
Bitrix24 is an online service that offers useful tools for your company.
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
import SmartActivityIcon from '@bitrix24/b24icons-vue/outline/SmartActivityIcon'
import FeedbackIcon from '@bitrix24/b24icons-vue/outline/FeedbackIcon'
import RocketIcon from '@bitrix24/b24icons-vue/outline/RocketIcon'
const items: AccordionItem[] = [
{
label: 'Getting started with Bitrix24',
icon: SmartActivityIcon,
content: 'Bitrix24 is an online service that offers useful tools for your company.'
},
{
label: 'Main features of Bitrix24',
icon: FeedbackIcon,
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
icon: RocketIcon,
content: 'Bitrix24 is an online service for business management and work automation.'
}
]
const active = ref('0')
// Note: This is for demonstration purposes only. Don't do this at home.
onMounted(() => {
setInterval(() => {
active.value = String((Number(active.value) + 1) % items.length)
}, 2000)
})
</script>
<template>
<B24Accordion v-model="active" :items="items" />
</template>
Use the value-key prop to change the key used to match items when a v-model or default-value is provided.
When type="multiple", ensure to pass an array to the default-value prop or the v-model directive.
Use the useSortable composable from @vueuse/integrations to enable drag and drop functionality on the Accordion. This integration wraps Sortable.js to provide a seamless drag and drop experience.
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
import { useSortable } from '@vueuse/integrations/useSortable'
import SmartActivityIcon from '@bitrix24/b24icons-vue/outline/SmartActivityIcon'
import FeedbackIcon from '@bitrix24/b24icons-vue/outline/FeedbackIcon'
import RocketIcon from '@bitrix24/b24icons-vue/outline/RocketIcon'
const items = shallowRef<AccordionItem[]>([
{
label: 'Getting started with Bitrix24',
icon: SmartActivityIcon,
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
icon: FeedbackIcon,
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
icon: RocketIcon,
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
])
const accordion = useTemplateRef<HTMLElement>('accordion')
useSortable(accordion, items, {
animation: 150
})
</script>
<template>
<B24Accordion ref="accordion" :items="items" />
</template>
Use the slot property to customize a specific item.
You will have access to the following slots:
#{{ item.slot }}
#{{ item.slot }}-body
<script setup lang="ts">
import type { AccordionItem } from '@bitrix24/b24ui-nuxt'
import SmartActivityIcon from '@bitrix24/b24icons-vue/outline/SmartActivityIcon'
import FeedbackIcon from '@bitrix24/b24icons-vue/outline/FeedbackIcon'
import RocketIcon from '@bitrix24/b24icons-vue/outline/RocketIcon'
const items = [
{
label: 'Getting started with Bitrix24',
icon: SmartActivityIcon,
content: 'Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
icon: FeedbackIcon,
slot: 'features' as const,
content: 'Bitrix24 is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
icon: RocketIcon,
content: 'Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
] satisfies AccordionItem[]
</script>
<template>
<B24Accordion :items="items">
<template #features="{ item }">
<p class="text-(length:--ui-font-size-sm) pb-3.5 text-(--ui-color-accent-main-primary)">
{{ item.content }}
</p>
</template>
</B24Accordion>
</template>
You can use the MDC component from @nuxtjs/mdc to render markdown in the accordion items.
Bitrix24 is an online service that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.
Bitrix24 is an online service that has all the tools for company operation and business management.
Bitrix24 is an online service for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.
<script setup lang="ts">
import SmartActivityIcon from '@bitrix24/b24icons-vue/outline/SmartActivityIcon'
import FeedbackIcon from '@bitrix24/b24icons-vue/outline/FeedbackIcon'
import RocketIcon from '@bitrix24/b24icons-vue/outline/RocketIcon'
const items = [
{
label: 'Getting started with Bitrix24',
icon: SmartActivityIcon,
content: 'Bitrix24 is an **online service** that offers useful tools for your company. This includes chats and calls, tasks and projects, CRM, and AI-powered assistant.'
},
{
label: 'Main features of Bitrix24',
icon: FeedbackIcon,
content: '[Bitrix24](https://www.bitrix24.com/) is an online service that has all the tools for company operation and business management.'
},
{
label: 'Bitrix24 Cloud plans',
icon: RocketIcon,
content: 'Bitrix24 is an `online service` for business management and work automation. It contains tools for companies of all sizes and industries. Bitrix24 has several plans with different sets of tools that are suitable for different types of business.'
}
]
</script>
<template>
<B24Accordion
type="multiple"
:items="items"
:unmount-on-hide="false"
:default-value="['3']"
:ui="{
trigger: 'text-base',
body: 'text-base text-(--b24ui-typography-description-color)'
}"
>
<template #body="{ item }">
<MDC :value="item.content" unwrap="p" />
</template>
</B24Accordion>
</template>
Matches a string with a regular expression, and returns an array containing the results of that search.
Matches a string or an object that supports being matched against, and returns an array
containing the results of that search, or null if no matches are found.
Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale.
trim: () => string
Removes the leading and trailing white space and line terminator characters from a string.
length: number
Returns the length of a String object.
substr: (from: number, length?: number | undefined) => string
Gets a substring beginning at the specified location and having the specified length.
codePointAt: (pos: number) => number
Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
value of the UTF-16 encoded code point starting at the string element at position pos in
the String resulting from converting this object to a String.
If there is no element at that position, the result is undefined.
If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
includes: (searchString: string, position?: number | undefined) => boolean
Returns true if searchString appears as a substring of the result of converting this
object to a String, at one or more positions that are
greater than or equal to position; otherwise, returns false.
endsWith: (searchString: string, endPosition?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
endPosition – length(this). Otherwise returns false.
Returns the String value result of normalizing the string into the normalization form
named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
repeat: (count: number) => string
Returns a String value that is made from count copies appended together. If count is 0,
the empty string is returned.
startsWith: (searchString: string, position?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
position. Otherwise returns false.
anchor: (name: string) => string
Returns an <a> HTML anchor element and sets the name attribute to the text value
big: () => string
Returns a <big> HTML element
blink: () => string
Returns a <blink> HTML element
bold: () => string
Returns a <b> HTML element
fixed: () => string
Returns a <tt> HTML element
fontcolor: (color: string) => string
Returns a <font> HTML element and sets the color attribute value
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the start (left) of the current string.
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the end (right) of the current string.
trimEnd: () => string
Removes the trailing white space and line terminator characters from a string.
trimStart: () => string
Removes the leading white space and line terminator characters from a string.
trimLeft: () => string
Removes the leading white space and line terminator characters from a string.
trimRight: () => string
Removes the trailing white space and line terminator characters from a string.
Matches a string with a regular expression, and returns an array containing the results of that search.
Matches a string or an object that supports being matched against, and returns an array
containing the results of that search, or null if no matches are found.
Returns a string where all alphabetic characters have been converted to uppercase, taking into account the host environment's current locale.
trim: () => string
Removes the leading and trailing white space and line terminator characters from a string.
length: number
Returns the length of a String object.
substr: (from: number, length?: number | undefined) => string
Gets a substring beginning at the specified location and having the specified length.
codePointAt: (pos: number) => number
Returns a nonnegative integer Number less than 1114112 (0x110000) that is the code point
value of the UTF-16 encoded code point starting at the string element at position pos in
the String resulting from converting this object to a String.
If there is no element at that position, the result is undefined.
If a valid UTF-16 surrogate pair does not begin at pos, the result is the code unit at pos.
includes: (searchString: string, position?: number | undefined) => boolean
Returns true if searchString appears as a substring of the result of converting this
object to a String, at one or more positions that are
greater than or equal to position; otherwise, returns false.
endsWith: (searchString: string, endPosition?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
endPosition – length(this). Otherwise returns false.
Returns the String value result of normalizing the string into the normalization form
named by form as specified in Unicode Standard Annex #15, Unicode Normalization Forms.
repeat: (count: number) => string
Returns a String value that is made from count copies appended together. If count is 0,
the empty string is returned.
startsWith: (searchString: string, position?: number | undefined) => boolean
Returns true if the sequence of elements of searchString converted to a String is the
same as the corresponding elements of this object (converted to a String) starting at
position. Otherwise returns false.
anchor: (name: string) => string
Returns an <a> HTML anchor element and sets the name attribute to the text value
big: () => string
Returns a <big> HTML element
blink: () => string
Returns a <blink> HTML element
bold: () => string
Returns a <b> HTML element
fixed: () => string
Returns a <tt> HTML element
fontcolor: (color: string) => string
Returns a <font> HTML element and sets the color attribute value
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the start (left) of the current string.
Pads the current string with a given string (possibly repeated) so that the resulting string reaches a given length.
The padding is applied from the end (right) of the current string.
trimEnd: () => string
Removes the trailing white space and line terminator characters from a string.
trimStart: () => string
Removes the leading white space and line terminator characters from a string.
trimLeft: () => string
Removes the leading white space and line terminator characters from a string.
trimRight: () => string
Removes the trailing white space and line terminator characters from a string.