Skip to content
ui8kit

component / components

Sidebar Panel

Sidebar Panel component

Install

npx ui8kit add sidebar-panel

Pulls in: block, compose, kit-box, presets, 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-cdn
npx ui8kit add sidebar-panel
components/sidebar-panel.svelte
<!-- 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 app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer. -->
<script lang="ts" module>
  import type { Snippet } from "svelte";
  import { variants } from "../utils";

  /** SidebarPanel: the classes of each value (shadcn/cva style). */
  export const sidebarPanelVariants = variants({
    base: "flex shrink-0 flex-col",
    variants: {
      variant: {
        chat: "w-68 gap-2 pt-6 pr-4 pb-6 pl-4",
        creator: "w-62 justify-between gap-4 p-4",
      },
    },
    defaultVariants: { variant: "chat" },
  });

  export type SidebarPanelProps = {
    variant?: "chat" | "creator";
    landmarkLabel?: string;
    class?: string;
    children?: Snippet;
  };
</script>

<script lang="ts">
  import Block from "../compose/Block.svelte";
  import { cn } from "../utils";

  let { variant, landmarkLabel, class: className, children }: SidebarPanelProps = $props();
</script>

<Block
  tag="aside"
  class={cn(sidebarPanelVariants({ variant: variant }), className)}
  data-slot="sidebar-panel"
  data-variant={(variant ?? "chat")}
  aria-label={landmarkLabel}
>
  {@render children?.()}
</Block>

Svelte registry item (JSON)

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-cdn
npx ui8kit add sidebar-panel
components/sidebar-panel.tsx
// 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 app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer. */
import { type ReactNode } from "react";
import { Block } from "../compose";
import { cn, variants } from "../utils";

/** SidebarPanel: the classes of each value (shadcn/cva style). */
export const sidebarPanelVariants = variants({
  base: "flex shrink-0 flex-col",
  variants: {
    variant: {
      chat: "w-68 gap-2 pt-6 pr-4 pb-6 pl-4",
      creator: "w-62 justify-between gap-4 p-4",
    },
  },
  defaultVariants: { variant: "chat" },
});

export type SidebarPanelProps = {
  variant?: "chat" | "creator";
  landmarkLabel?: string;
  className?: string;
  children?: ReactNode;
};

export function SidebarPanel({ variant, landmarkLabel, className, children }: SidebarPanelProps) {
  return (
    <Block
      tag="aside"
      className={cn(sidebarPanelVariants({ variant: variant }), className)}
      data-slot="sidebar-panel"
      data-variant={(variant ?? "chat")}
      aria-label={landmarkLabel}
    >
      {children}
    </Block>
  );
}

React registry item (JSON)

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-cdn
npx ui8kit add sidebar-panel
components/sidebar-panel.vue
<!-- 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 app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer. -->
<script lang="ts">
import { variants } from "../utils";

/** SidebarPanel: the classes of each value (shadcn/cva style). */
export const sidebarPanelVariants = variants({
  base: "flex shrink-0 flex-col",
  variants: {
    variant: {
      chat: "w-68 gap-2 pt-6 pr-4 pb-6 pl-4",
      creator: "w-62 justify-between gap-4 p-4",
    },
  },
  defaultVariants: { variant: "chat" },
});

export type SidebarPanelProps = {
  variant?: "chat" | "creator";
  landmarkLabel?: string;
  class?: string;
};
</script>

<script setup lang="ts">
import Block from "../compose/Block.vue";
import { cn } from "../utils";

const { variant, landmarkLabel, class: className } = defineProps<SidebarPanelProps>();
defineSlots<{ default?(): unknown }>();
</script>

<template>
  <Block
    tag="aside"
    :class="cn(sidebarPanelVariants({ variant: variant }), className)"
    data-slot="sidebar-panel"
    :data-variant="(variant ?? 'chat')"
    :aria-label="landmarkLabel"
  >
    <slot />
  </Block>
</template>

Vue registry item (JSON)

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-cdn
npx ui8kit add sidebar-panel
components/sidebar-panel.tsx
// 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 app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer. */
import { type JSX } from "solid-js";
import { Block } from "../compose";
import { cn, variants } from "../utils";

/** SidebarPanel: the classes of each value (shadcn/cva style). */
export const sidebarPanelVariants = variants({
  base: "flex shrink-0 flex-col",
  variants: {
    variant: {
      chat: "w-68 gap-2 pt-6 pr-4 pb-6 pl-4",
      creator: "w-62 justify-between gap-4 p-4",
    },
  },
  defaultVariants: { variant: "chat" },
});

export type SidebarPanelProps = {
  variant?: "chat" | "creator";
  landmarkLabel?: string;
  class?: string;
  children?: JSX.Element;
};

export function SidebarPanel({ variant, landmarkLabel, class: className, children }: SidebarPanelProps) {
  return (
    <Block
      tag="aside"
      class={cn(sidebarPanelVariants({ variant: variant }), className)}
      data-slot="sidebar-panel"
      data-variant={(variant ?? "chat")}
      aria-label={landmarkLabel}
    >
      {children}
    </Block>
  );
}

Solid registry item (JSON)

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-cdn
npx ui8kit add sidebar-panel
blocks/sidebar-panel.templ
// 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/patterns/sidebar-panel.json

package blocks

import (
	"github.com/ui8kit/codegen/generated/templ/ui/box"
	"github.com/ui8kit/codegen/generated/templ/compose"
	uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)

// SidebarPanelProps are the props of SidebarPanel; the values are the JSON shapes of the TypeScript props.
type SidebarPanelProps struct {
	Variant any `json:"variant"`
	LandmarkLabel any `json:"landmarkLabel"`
	Class string `json:"className"`
}

// The app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer.
templ SidebarPanel(p SidebarPanelProps) {
	{{ vVariant := p.Variant }}
	{{ vLandmarkLabel := p.LandmarkLabel }}
	@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "aside", Class: uiutils.S(uiutils.Cnv(recipeSidebarPanel.Of(map[string]any{"variant": vVariant}), p.Class)), Attrs: uiutils.Attrs("data-slot", "sidebar-panel", "data-variant", uiutils.Coalesce(vVariant, "chat"), "aria-label", vLandmarkLabel)}}) {
		{ children... }
	}
}

templ registry item (JSON)

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-cdn
npx ui8kit add sidebar-panel
blocks/sidebar-panel.html.twig
{#- 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/patterns/sidebar-panel.json
    The app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer.
    Props (p): variant, landmarkLabel, className; children: markup. -#}
{%- set v_variant = (p.variant ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- set c_1 -%}
  {{ og_slot((children ?? null))|raw }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'aside', 'class': og_s(og_cnv([og_recipe('blocks/recipes/sidebar-panel.variants.json', {'variant': v_variant}), (p.className ?? '')])), 'attrs': og_attrs(['data-slot', 'sidebar-panel', 'data-variant', og_coalesce([v_variant, 'chat']), 'aria-label', v_landmarkLabel]), 'children': c_1}, with_context = false) }}

Twig registry item (JSON)

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-cdn
npx ui8kit add sidebar-panel
blocks/sidebar-panel.latte
{* 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/patterns/sidebar-panel.json
    The app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer.
    Props (p): variant, landmarkLabel, className; children: markup. *}
{var $v_variant = ($p['variant'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{capture $c_1}
  {=og_slot(($children ?? null))|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'aside', 'class' => og_s(og_cnv([og_recipe('blocks/recipes/sidebar-panel.variants.json', ['variant' => $v_variant]), ($p['className'] ?? '')])), 'attrs' => og_attrs(['data-slot', 'sidebar-panel', 'data-variant', og_coalesce([$v_variant, 'chat']), 'aria-label', $v_landmarkLabel]), 'children' => (string) $c_1])|noescape}

Latte registry item (JSON)

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-cdn
npx ui8kit add sidebar-panel
blocks/sidebar-panel.html.j2
{#- 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/patterns/sidebar-panel.json
    The app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer.
    Props (p): variant, landmarkLabel, className; children: markup. -#}
{%- set v_variant = og_def(p['variant'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- set c_1 -%}
  {{ og_slot(og_def(children, none))|safe }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'aside', 'Class': og_s(og_cnv([og_recipe('blocks/recipes/sidebar-panel.variants.json', {'variant': v_variant}), og_def(p['className'], '')])), 'Attrs': og_attrs(['data-slot', 'sidebar-panel', 'data-variant', og_coalesce([v_variant, 'chat']), 'aria-label', v_landmarkLabel])}, 'children': c_1}) }}

Jinja2 registry item (JSON)

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 app sidebar panel: width, padding and gap per kit sidebar type. Colours come from the middle layer.

Props of SidebarPanel
PropTypeDefault Description
variant "chat" | "creator"-sidebar type
landmarkLabel string-accessible name of the landmark of this component when the page shows it more than once (a variant); replaces the heading name of the root landmark, follows the name of a nested one