Table Toolbar
Table Toolbar component
Install
npx ui8kit add table-toolbarPulls in: box, compose, inline, kit-box, kit-text, utils
Preview
No static preview for this item: it needs content or a parent that this page cannot supply. The code is below.
Code
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework svelte --dir src --registry-url https://registry.buildy.tw/svelte --strict-cdnnpx ui8kit add table-toolbar<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
The toolbar above a table: search and filter controls on the left (children), the actions on the right
(`actions`). One tab stop group (role toolbar).
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
export type TableToolbarProps = {
label: string;
class?: string;
children?: Snippet;
actions?: Snippet;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Inline from "../compose/Inline.svelte";
import { cn } from "../utils";
let { label, class: className, children, actions }: TableToolbarProps = $props();
</script>
<Box
class={cn("flex flex-wrap items-center justify-between gap-2", className)}
role="toolbar"
aria-label={label}
data-slot="table-toolbar"
>
<Inline class="flex min-w-0 flex-wrap items-center gap-2">
{@render children?.()}
</Inline>
<Inline class="flex flex-wrap items-center gap-2">
{@render actions?.()}
</Inline>
</Box>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework react --dir src --registry-url https://registry.buildy.tw/react --strict-cdnnpx ui8kit add table-toolbar// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* The toolbar above a table: search and filter controls on the left (children), the actions on the right
* (`actions`). One tab stop group (role toolbar).
*/
import { type ReactNode } from "react";
import { Box, Inline } from "../compose";
import { cn } from "../utils";
export type TableToolbarProps = {
label: string;
className?: string;
children?: ReactNode;
actions?: ReactNode;
};
export function TableToolbar({ label, className, children, actions }: TableToolbarProps) {
return (
<Box
className={cn("flex flex-wrap items-center justify-between gap-2", className)}
role="toolbar"
aria-label={label}
data-slot="table-toolbar"
>
<Inline className="flex min-w-0 flex-wrap items-center gap-2">
{children}
</Inline>
<Inline className="flex flex-wrap items-center gap-2">
{actions}
</Inline>
</Box>
);
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework vue --dir src --registry-url https://registry.buildy.tw/vue --strict-cdnnpx ui8kit add table-toolbar<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
The toolbar above a table: search and filter controls on the left (children), the actions on the right
(`actions`). One tab stop group (role toolbar).
-->
<script lang="ts">
export type TableToolbarProps = {
label: string;
class?: string;
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import Inline from "../compose/Inline.vue";
import { cn } from "../utils";
const { label, class: className } = defineProps<TableToolbarProps>();
defineSlots<{ default?(): unknown, actions?(): unknown }>();
</script>
<template>
<Box
:class="cn('flex flex-wrap items-center justify-between gap-2', className)"
role="toolbar"
:aria-label="label"
data-slot="table-toolbar"
>
<Inline class="flex min-w-0 flex-wrap items-center gap-2">
<slot />
</Inline>
<Inline class="flex flex-wrap items-center gap-2">
<slot name="actions" />
</Inline>
</Box>
</template>
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework solid --dir src --registry-url https://registry.buildy.tw/solid --strict-cdnnpx ui8kit add table-toolbar// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* The toolbar above a table: search and filter controls on the left (children), the actions on the right
* (`actions`). One tab stop group (role toolbar).
*/
import { type JSX } from "solid-js";
import { Box, Inline } from "../compose";
import { cn } from "../utils";
export type TableToolbarProps = {
label: string;
class?: string;
children?: JSX.Element;
actions?: JSX.Element;
};
export function TableToolbar({ label, class: className, children, actions }: TableToolbarProps) {
return (
<Box
class={cn("flex flex-wrap items-center justify-between gap-2", className)}
role="toolbar"
aria-label={label}
data-slot="table-toolbar"
>
<Inline class="flex min-w-0 flex-wrap items-center gap-2">
{children}
</Inline>
<Inline class="flex flex-wrap items-center gap-2">
{actions}
</Inline>
</Box>
);
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework templ --dir src --registry-url https://registry.buildy.tw/templ --strict-cdnnpx ui8kit add table-toolbar// Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
// Source: packages/compose-gen/specs/parts/table-toolbar.json
package blocks
import (
"github.com/ui8kit/codegen/generated/templ/ui/box"
"github.com/ui8kit/codegen/generated/templ/compose"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// TableToolbarProps are the props of TableToolbar; the values are the JSON shapes of the TypeScript props.
type TableToolbarProps struct {
Label any `json:"label"`
Class string `json:"className"`
Actions templ.Component `json:"-"`
}
// The toolbar above a table: search and filter controls on the left (children), the actions on the right (`actions`). One tab stop group (role toolbar).
templ TableToolbar(p TableToolbarProps) {
{{ vLabel := p.Label }}
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv("flex flex-wrap items-center justify-between gap-2", p.Class)), Attrs: uiutils.Attrs("role", "toolbar", "aria-label", vLabel, "data-slot", "table-toolbar")}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex min-w-0 flex-wrap items-center gap-2"}}) {
{ children... }
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex flex-wrap items-center gap-2"}}) {
if p.Actions != nil {
@p.Actions
}
}
}
}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework twig --dir src --registry-url https://registry.buildy.tw/twig --strict-cdnnpx ui8kit add table-toolbar{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/parts/table-toolbar.json
The toolbar above a table: search and filter controls on the left (children), the actions on the right (`actions`). One tab stop group (role toolbar).
Props (p): label, className, actions (slot); children: markup. -#}
{%- set v_label = (p.label ?? null) -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_slot((children ?? null))|raw }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'flex min-w-0 flex-wrap items-center gap-2', 'children': c_1}, with_context = false) }}
{%- set c_2 -%}
{{ og_slot((p.actions ?? null))|raw }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'flex flex-wrap items-center gap-2', 'children': c_2}, with_context = false) }}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s(og_cnv(['flex flex-wrap items-center justify-between gap-2', (p.className ?? '')])), 'attrs': og_attrs(['role', 'toolbar', 'aria-label', v_label, 'data-slot', 'table-toolbar']), 'children': c_3}, with_context = false) }}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework latte --dir src --registry-url https://registry.buildy.tw/latte --strict-cdnnpx ui8kit add table-toolbar{* Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/parts/table-toolbar.json
The toolbar above a table: search and filter controls on the left (children), the actions on the right (`actions`). One tab stop group (role toolbar).
Props (p): label, className, actions (slot); children: markup. *}
{var $v_label = ($p['label'] ?? null)}
{capture $c_3}
{capture $c_1}
{=og_slot(($children ?? null))|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'flex min-w-0 flex-wrap items-center gap-2', 'children' => (string) $c_1])|noescape}
{capture $c_2}
{=og_slot(($p['actions'] ?? null))|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'flex flex-wrap items-center gap-2', 'children' => (string) $c_2])|noescape}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s(og_cnv(['flex flex-wrap items-center justify-between gap-2', ($p['className'] ?? '')])), 'attrs' => og_attrs(['role', 'toolbar', 'aria-label', $v_label, 'data-slot', 'table-toolbar']), 'children' => (string) $c_3])|noescape}
Point the CLI at this runtime once, then add the item:
npx ui8kit init --yes --framework jinja2 --dir src --registry-url https://registry.buildy.tw/jinja2 --strict-cdnnpx ui8kit add table-toolbar{#- Code generated by packages/kit-compose/src/server-organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
Source: packages/compose-gen/specs/parts/table-toolbar.json
The toolbar above a table: search and filter controls on the left (children), the actions on the right (`actions`). One tab stop group (role toolbar).
Props (p): label, className, actions (slot); children: markup. -#}
{%- set v_label = og_def(p['label'], none) -%}
{%- set c_3 -%}
{%- set c_1 -%}
{{ og_slot(og_def(children, none))|safe }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex min-w-0 flex-wrap items-center gap-2'}, 'children': c_1}) }}
{%- set c_2 -%}
{{ og_slot(og_def(p['actions'], none))|safe }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex flex-wrap items-center gap-2'}, 'children': c_2}) }}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv(['flex flex-wrap items-center justify-between gap-2', og_def(p['className'], '')])), 'Attrs': og_attrs(['role', 'toolbar', 'aria-label', v_label, 'data-slot', 'table-toolbar'])}, 'children': c_3}) }}
Props
Names and types come from the xgen specs of the source. Standard HTML attributes (id, role, tabIndex, aria-*) pass through to the root element; the class prop is className in React.
The toolbar above a table: search and filter controls on the left (children), the actions on the right (`actions`). One tab stop group (role toolbar).
| Prop | Type | Default | Description |
|---|---|---|---|
| label (required) | string | - | accessible name of the toolbar |