Table

A responsive table component.

Installation

The CLI is not yet available. For now, manually copy the component source into your project.

rust-shadcn-ui add table

Usage

use yew::prelude::*;

use crate::components::ui::table::{
    Table,
    TableBody,
    TableCaption,
    TableCell,
    TableHead,
    TableHeader,
    TableRow,
};

#[component]
fn Usage() -> impl IntoView {
    view! {
        <Table>
            <TableCaption>{"A list of your recent invoices."}</TableCaption>
            <TableHeader>
                <TableRow>
                    <TableHead class="w-[100px]">{"Invoice"}</TableHead>
                    <TableHead>{"Status"}</TableHead>
                    <TableHead>{"Method"}</TableHead>
                    <TableHead class="text-right">{"Amount"}</TableHead>
                </TableRow>
            </TableHeader>
            <TableBody>
                <TableRow>
                    <TableCell class="font-medium">{"INV001"}</TableCell>
                    <TableCell>{"Paid"}</TableCell>
                    <TableCell>{"Credit Card"}</TableCell>
                    <TableCell class="text-right">{"$250.00"}</TableCell>
                </TableRow>
            </TableBody>
        </Table>
    }
}

See Also