<script> import { Table } from 'svelte-5-ui-lib'; const tableItems = [ { name: 'Apple MacBook Pro 17"', color: 'Sliver', type: 'Laptop', price: '$2999' }, { name: 'Microsoft Surface Pro', color: 'White', type: 'Laptop PC', price: '$1999' }, { name: 'Magic Mouse 2', color: 'Black', type: 'Accessories', price: '$99' }, { name: 'Google Pixel Phone', color: 'Gray', type: 'Phone', price: '$799' }, { name: 'Apple Watch 5', color: 'Red', type: 'Wearables', price: '$999' } ]; </script>
<Table {tableItems} noborder />
<script lang="ts"> import { Table } from 'svelte-5-ui-lib'; const tableItems = [ { name: 'Apple MacBook Pro 17"', color: 'Sliver', type: 'Laptop', price: '$2999' }, { name: 'Microsoft Surface Pro', color: 'White', type: 'Laptop PC', price: '$1999' }, { name: 'Magic Mouse 2', color: 'Black', type: 'Accessories', price: '$99' }, { name: 'Google Pixel Phone', color: 'Gray', type: 'Phone', price: '$799' }, { name: 'Apple Watch 5', color: 'Red', type: 'Wearables', price: '$999' } ]; </script> <Table {tableItems} hoverable />
<script lang="ts"> import { Table, TableHead, TableBody } from 'svelte-5-ui-lib'; const headItems = ['Name', 'Color', 'Type', 'Price']; const bodyItems = [ ['Apple MacBook Pro 17"', 'Sliver', 'Laptop', '$2999'], ['Microsoft Surface Pro', 'White', 'Laptop PC', '$1999'], ['Magic Mouse 2', 'Black', 'Accessories', '$99'], ['Google Pixel Phone', 'Gray', 'Phone', '$799'], ['Apple Watch 5', 'Red', 'Wearables', '$999'] ]; </script> <Table hoverable> <TableHead {headItems} /> <TableBody {bodyItems} /> </Table>
<script lang="ts"> import { Table, TableHead, TableHeadCell, TableBody, TableBodyRow, TableBodyCell } from 'svelte-5-ui-lib'; </script> <Table hoverable> <TableHead> <TableHeadCell>Product name</TableHeadCell> <TableHeadCell>Color</TableHeadCell> <TableHeadCell>Category</TableHeadCell> <TableHeadCell>Price</TableHeadCell> <TableHeadCell> <span class="sr-only">Edit</span> </TableHeadCell> </TableHead> <TableBody class="divide-y"> <TableBodyRow> <TableBodyCell>Apple MacBook Pro 17"</TableBodyCell> <TableBodyCell>Sliver</TableBodyCell> <TableBodyCell>Laptop</TableBodyCell> <TableBodyCell>$2999</TableBodyCell> <TableBodyCell> <a href="/tables" class="text-primary-600 dark:text-primary-500 font-medium hover:underline" >Edit</a > </TableBodyCell> </TableBodyRow> <TableBodyRow> <TableBodyCell>Microsoft Surface Pro</TableBodyCell> <TableBodyCell>White</TableBodyCell> <TableBodyCell>Laptop PC</TableBodyCell> <TableBodyCell>$1999</TableBodyCell> <TableBodyCell> <a href="/tables" class="text-primary-600 dark:text-primary-500 font-medium hover:underline" >Edit</a > </TableBodyCell> </TableBodyRow> <TableBodyRow> <TableBodyCell>Magic Mouse 2</TableBodyCell> <TableBodyCell>Black</TableBodyCell> <TableBodyCell>Accessories</TableBodyCell> <TableBodyCell>$99</TableBodyCell> <TableBodyCell> <a href="/tables" class="text-primary-600 dark:text-primary-500 font-medium hover:underline" >Edit</a > </TableBodyCell> </TableBodyRow> <TableBodyRow> <TableBodyCell>Google Pixel Phone</TableBodyCell> <TableBodyCell>Gray</TableBodyCell> <TableBodyCell>Phone</TableBodyCell> <TableBodyCell>$799</TableBodyCell> <TableBodyCell> <a href="/tables" class="text-primary-600 dark:text-primary-500 font-medium hover:underline" >Edit</a > </TableBodyCell> </TableBodyRow> <TableBodyRow> <TableBodyCell>Apple Watch 5</TableBodyCell> <TableBodyCell>Red</TableBodyCell> <TableBodyCell>Wearables</TableBodyCell> <TableBodyCell>$999</TableBodyCell> <TableBodyCell> <a href="/tables" class="text-primary-600 dark:text-primary-500 font-medium hover:underline" >Edit</a > </TableBodyCell> </TableBodyRow> </TableBody> </Table>
<script lang="ts"> import { Table, TableHead, TableHeadCell, TableBody, TableBodyRow, TableBodyCell, Checkbox } from 'svelte-5-ui-lib'; </script> <Table hoverable={true}> <TableHead> <TableHeadCell class="!p-4"> <Checkbox /> </TableHeadCell> <TableHeadCell>Product name</TableHeadCell> <TableHeadCell>Color</TableHeadCell> <TableHeadCell>Category</TableHeadCell> <TableHeadCell>Price</TableHeadCell> <TableHeadCell> <span class="sr-only">Edit</span> </TableHeadCell> </TableHead> <TableBody class="divide-y"> <TableBodyRow> <TableBodyCell class="!p-4"> <Checkbox /> </TableBodyCell> <TableBodyCell>Apple MacBook Pro 17"</TableBodyCell> <TableBodyCell>Sliver</TableBodyCell> <TableBodyCell>Laptop</TableBodyCell> <TableBodyCell>$2999</TableBodyCell> <TableBodyCell> <a href="/components/table" class="text-primary-600 dark:text-primary-500 font-medium hover:underline">Edit</a > </TableBodyCell> </TableBodyRow> <TableBodyRow> <TableBodyCell class="!p-4"> <Checkbox /> </TableBodyCell> <TableBodyCell>Microsoft Surface Pro</TableBodyCell> <TableBodyCell>White</TableBodyCell> <TableBodyCell>Laptop PC</TableBodyCell> <TableBodyCell>$1999</TableBodyCell> <TableBodyCell> <a href="/components/table" class="text-primary-600 dark:text-primary-500 font-medium hover:underline">Edit</a > </TableBodyCell> </TableBodyRow> <TableBodyRow> <TableBodyCell class="!p-4"> <Checkbox /> </TableBodyCell> <TableBodyCell>Magic Mouse 2</TableBodyCell> <TableBodyCell>Black</TableBodyCell> <TableBodyCell>Accessories</TableBodyCell> <TableBodyCell>$99</TableBodyCell> <TableBodyCell> <a href="/components/table" class="text-primary-600 dark:text-primary-500 font-medium hover:underline">Edit</a > </TableBodyCell> </TableBodyRow> </TableBody> </Table>
<script lang="ts"> import { TableSearch, TableHead, TableBody, TableBodyRow, TableBodyCell } from 'svelte-5-ui-lib'; const headItems = ['ID', 'Maker', 'Type', 'Make']; let searchTerm = $state(''); let items = [ { id: 1, maker: 'Toyota', type: 'ABC', make: 2017 }, { id: 2, maker: 'Ford', type: 'CDE', make: 2018 }, { id: 3, maker: 'Volvo', type: 'FGH', make: 2019 }, { id: 4, maker: 'Saab', type: 'IJK', make: 2020 } ]; let filteredItems = $derived( items.filter((item) => item.maker.toLowerCase().indexOf(searchTerm.toLowerCase()) !== -1) ); </script> <TableSearch placeholder="Search by maker name" hoverable={true} bind:inputValue={searchTerm}> <TableHead {headItems} /> <TableBody> {#each filteredItems as item} <TableBodyRow> <TableBodyCell>{item.id}</TableBodyCell> <TableBodyCell>{item.maker}</TableBodyCell> <TableBodyCell>{item.type}</TableBodyCell> <TableBodyCell>{item.make}</TableBodyCell> </TableBodyRow> {/each} </TableBody> </TableSearch>
<script lang="ts"> import { Table, TableHead, TableHeadCell, TableBody } from 'svelte-5-ui-lib'; const headItems = ['Brand', 'Name', 'Color', 'Type', 'Price']; const bodyItems = [ ['Apple', 'MacBook Pro 17"', 'Sliver', 'Laptop', '$2999'], ['Microsoft', 'Surface Pro', 'White', 'Laptop PC', '$1999'], ['Apple', 'Magic Mouse 2', 'Black', 'Accessories', '$99'], ['Google', ' Pixel Phone', 'Gray', 'Phone', '$799'], ['Apple', 'Watch 5', 'Red', 'Wearables', '$999'] ]; </script> <Table> <TableHead {headItems} defaultRow={false}> {#snippet headerSlot()} <tr> <TableHeadCell colspan={2}>Product</TableHeadCell> <TableHeadCell colspan={3}>Info</TableHeadCell> </tr> {/snippet} </TableHead> <TableBody {bodyItems} /> </Table>
<script lang="ts"> import { Table } from 'svelte-5-ui-lib'; const tableItems = [ { name: 'Apple MacBook Pro 17"', qty: '1', price: '$2999' }, { name: 'Microsoft Surface Pro', qty: '1', price: '$1999' }, { name: 'Magic Mouse 2', qty: '1', price: '$99' } ]; </script> <Table {tableItems} hoverable> {#snippet footerSlot()} <tfoot> <tr class="font-semibold text-gray-900 dark:text-white"> <th scope="row" class="px-6 py-3 text-base">Total</th> <td class="px-6 py-3">3</td> <td class="px-6 py-3">$5,097</td> </tr> </tfoot> {/snippet} </Table>
Browse a list of Flowbite products designed to help you work and play, stay organized, get answers, keep in touch, grow your business, and more.
<script lang="ts"> import { Table, TableHead, TableBody } from 'svelte-5-ui-lib'; const headItems = ['Brand', 'Name', 'Color', 'Type', 'Price']; const bodyItems = [ ['Apple', 'MacBook Pro 17"', 'Sliver', 'Laptop', '$2999'], ['Microsoft', 'Surface Pro', 'White', 'Laptop PC', '$1999'], ['Apple', 'Magic Mouse 2', 'Black', 'Accessories', '$99'], ['Google', ' Pixel Phone', 'Gray', 'Phone', '$799'], ['Apple', 'Watch 5', 'Red', 'Wearables', '$999'] ]; </script> <Table> {#snippet captionSlot()} <caption class="bg-white p-5 text-left text-lg font-semibold text-gray-900 dark:bg-gray-800 dark:text-white" > Our products <p class="mt-1 text-sm font-normal text-gray-500 dark:text-gray-400"> Browse a list of Flowbite products designed to help you work and play, stay organized, get answers, keep in touch, grow your business, and more. </p> </caption> {/snippet} <TableHead {headItems} /> <TableBody {bodyItems} /> </Table>
<script lang="ts"> import { Table } from 'svelte-5-ui-lib'; const tableItems = [ { name: 'Apple MacBook Pro 17"', color: 'Sliver', category: 'Laptop', accessories: 'Yes', available: 'Yes', price: '$2999', weight: '2.3kg', qty: '1' }, { name: 'Microsoft Surface Pro', color: 'White', category: 'Laptop PC', accessories: 'No', available: 'Yes', price: '$1999', weight: '1.8kg', qty: '1' }, { name: 'Magic Mouse 2', color: 'Black', category: 'Accessories', accessories: 'Yes', available: 'No', price: '$99', weight: '0.6kg', qty: '2' } ]; </script> <Table {tableItems} />