Components
List
A ledger of rows: Root is the list, Item one row, Leading the mark before the words, Content the title and its quiet echo, Actions the way out. The bordered variant draws the hairlines; the hoverable variant gives every row the wash — and any row the caller makes clickable (role="button") answers the pointer on its own.
#Basic usage
- SWSeal registryWho pressed which seal, and when.
- LWLetter roomCorrespondence awaiting the registrar.
- ABArchive annexShelved records, fourth row, eastern cabinet.
<script setup lang="ts">
import { Avatar, Button, List } from "@bysages/vue";
const rows = [
{
initials: "SW",
title: "Seal registry",
description: "Who pressed which seal, and when.",
},
{
initials: "LW",
title: "Letter room",
description: "Correspondence awaiting the registrar.",
},
{
initials: "AB",
title: "Archive annex",
description: "Shelved records, fourth row, eastern cabinet.",
},
];
</script>
<template>
<List.Root class="w-full">
<List.Item v-for="row in rows" :key="row.title">
<List.Leading>
<Avatar.Root>
<Avatar.Fallback>{{ row.initials }}</Avatar.Fallback>
</Avatar.Root>
</List.Leading>
<List.Content>
<template #title>{{ row.title }}</template>
<template #description>{{ row.description }}</template>
</List.Content>
<List.Actions>
<Button variant="ghost" size="sm">Open</Button>
</List.Actions>
</List.Item>
</List.Root>
</template>
- Morning readingsBarometer steady, ink flows well.
- Noon deliveriesTwo crates of paper from the mill.
- Evening closingsThe lamps are trimmed at dusk.
Nothing opened yet.
<script setup lang="ts">
import { List } from "@bysages/vue";
import { ref } from "vue";
const opened = ref("");
const ledger = [
{ title: "Morning readings", description: "Barometer steady, ink flows well." },
{ title: "Noon deliveries", description: "Two crates of paper from the mill." },
{ title: "Evening closings", description: "The lamps are trimmed at dusk." },
];
const open = (title: string) => {
opened.value = title;
};
</script>
<template>
<div class="w-full">
<List.Root bordered hoverable class="w-full">
<List.Item
v-for="row in ledger"
:key="row.title"
role="button"
tabindex="0"
@click="open(row.title)"
@keydown.enter.prevent="open(row.title)"
@keydown.space.prevent="open(row.title)"
>
<List.Content>
<template #title>{{ row.title }}</template>
<template #description>{{ row.description }}</template>
</List.Content>
</List.Item>
</List.Root>
<p role="status" class="mt-4 text-sm text-tertiary">
{{ opened ? `Opened “${opened}”.` : "Nothing opened yet." }}
</p>
</div>
</template>
#Props
#ListRoot
| Prop | Type | Default | Description |
|---|---|---|---|
bordered | Boolean | false | One hairline between rows. |
hoverable | Boolean | false | Every row answers the pointer with a wash. |
#ListItem
A styled part — no props of its own; it takes the anatomy's shared styling.
#ListLeading
A styled part — no props of its own; it takes the anatomy's shared styling.
#ListActions
A styled part — no props of its own; it takes the anatomy's shared styling.
#ListContent
The row's words: the title and description ride their own named slots, the default slot follows them for anything else.
A styled part — no props of its own; it takes the anatomy's shared styling.