Component
- Item 1
- Item 2
- Item 3
Props
| Props | Default | Type |
|---|---|---|
items | An example array | any[] |
hasSeparator | false | boolean |
layout | ListLayout.LIST | ListLayout |
cols | 2 | number |
tabletCols | 2 | number |
mobileCols | 1 | number |
gapClass | 'gap-6' | string |
listItemIcon | mdi:check | string |
listItemIconClass | text-icon-secondary-brand-default | string |
listItemSize | ListItemSize.SM | ListItemSize |
spaced | false | boolean |
Slots
| Name | Description |
|---|---|
default | Default slot to insert items. |
<template>
<List>
<ListItem
v-for="(item, index) in items" :key="index"
>
{{ item }}
</ListItem>
</List>
</template>
<script setup lang="ts">
const items = ref<DropdownMenuItem[]>([
{
text: "Item 1",
},
{
text: "Item 2",
},
{
text: "Item 3",
},
])
</script>
Components
| Name | Description |
|---|---|
<ListItem> | The component to display in the list. |
Usage
items
List of items to display in the list. It can be used instead of the default slot.
<template>
<List
:items="exampleItems"
/>
</template>
<script setup lang="ts">
const exampleItems = ref(["Item 1", "Item 2", "Item 3"])
</script>
hasSeparator
If set to true, a separator will be displayed at the top and bottom of each item.
<template>
<List
:hasSeparator="true"
/>
</template>
layout
The layout of the list. In case of using grid layout, the number of columns can be customized by using the cols, tabletCols and mobileCols props.
Uses the ListLayout enum.
<template>
<List
:layout="ListLayout.LIST"
/>
</template>
Options
| Value | Description |
|---|---|
LIST | List |
GRID | Grid |
cols, tabletCols and mobileCols
The number of columns in the grid layout.
<template>
<List
:layout="ListLayout.GRID"
:cols="2"
:tabletCols="2"
:mobileCols="1"
/>
</template>
gapClass
The gap class applied to the list when using grid layout.
<template>
<List
:layout="ListLayout.GRID"
gapClass="gap-4"
/>
</template>
listItemIcon
The icon displayed as the marker on the list item. If it is not provided, the list item will not use any icon.
<template>
<List
listItemIcon="mdi:check"
/>
</template>
listItemIconClass
The class applied to the icon displayed as the marker on the list item.
<template>
<List
listItemIcon="mdi:check"
listItemIconClass="text-icon-secondary-brand-default"
/>
</template>
listItemSize
The size of the list item. Uses the ListItemSize enum.
<template>
<List
:listItemSize="ListItemSize.SM"
/>
</template>
Options
| Value | Description |
|---|---|
xs | XS |
sm | SM |
md | MD |
spaced
If set to true, the list items will be have more vertical spaced
<template>
<List
spaced
/>
</template>
ListItem
<ListItem> represents the individual item within the <List> component.
Props
| Props | Default | Type |
|---|---|---|
markerIcon | — | string |
markerIconClass | 'text-icon-secondary-brand-default' | string |
spaced | false | boolean |
size | ListItemSize.SM | ListItemSize |
Usage
The <ListItem> component props shares some props with the <List> component.
They work the same with the difference of some props naming.
Please have a look at the usage of the similar props in the <List> component.