Logo Sidebar
Logo Sidebar component
Install
npx ui8kit add logo-sidebarPulls in: box, compose, inline, kit-box, kit-text, presets, utils
Preview
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 logo-sidebar<!-- 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 brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The
variant picks the padding (recipe).
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
import { variants } from "../utils";
/** LogoSidebar: the classes of each value (shadcn/cva style). */
export const logoSidebarVariants = variants({
base: "flex h-8 items-center justify-between",
variants: {
variant: {
chat: "px-2",
creator: "pr-4",
},
},
defaultVariants: { variant: "chat" },
});
export type LogoSidebarProps = {
variant?: "chat" | "creator";
name: string;
class?: string;
mark?: Snippet;
actions?: Snippet;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import Inline from "../compose/Inline.svelte";
import { cn } from "../utils";
let { variant = "chat", name, class: className, mark, actions }: LogoSidebarProps = $props();
</script>
<Box
class={cn(
logoSidebarVariants({ variant: variant }),
"in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0",
className
)}
data-slot="logo-sidebar"
>
<Inline class="flex items-center gap-4" data-slot="logo-sidebar-brand">
{@render mark?.()}
<Inline class="text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden" data-slot="logo-sidebar-name">
{name}
</Inline>
</Inline>
{#if actions}
<Inline class="flex items-center gap-2 in-data-[nav=collapsed]:hidden" data-slot="logo-sidebar-actions">
{@render actions?.()}
</Inline>
{/if}
</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 logo-sidebar// 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 brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The
* variant picks the padding (recipe).
*/
import { type ReactNode } from "react";
import { Box, Inline } from "../compose";
import { cn, variants } from "../utils";
/** LogoSidebar: the classes of each value (shadcn/cva style). */
export const logoSidebarVariants = variants({
base: "flex h-8 items-center justify-between",
variants: {
variant: {
chat: "px-2",
creator: "pr-4",
},
},
defaultVariants: { variant: "chat" },
});
export type LogoSidebarProps = {
variant?: "chat" | "creator";
name: string;
className?: string;
mark?: ReactNode;
actions?: ReactNode;
};
export function LogoSidebar({ variant = "chat", name, className, mark, actions }: LogoSidebarProps) {
return (
<Box
className={cn(
logoSidebarVariants({ variant: variant }),
"in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0",
className
)}
data-slot="logo-sidebar"
>
<Inline className="flex items-center gap-4" data-slot="logo-sidebar-brand">
{mark}
<Inline
className="text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden"
data-slot="logo-sidebar-name"
>
{name}
</Inline>
</Inline>
{actions ? (
<Inline className="flex items-center gap-2 in-data-[nav=collapsed]:hidden" data-slot="logo-sidebar-actions">
{actions}
</Inline>
) : null}
</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 logo-sidebar<!-- 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 brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The
variant picks the padding (recipe).
-->
<script lang="ts">
import { variants } from "../utils";
/** LogoSidebar: the classes of each value (shadcn/cva style). */
export const logoSidebarVariants = variants({
base: "flex h-8 items-center justify-between",
variants: {
variant: {
chat: "px-2",
creator: "pr-4",
},
},
defaultVariants: { variant: "chat" },
});
export type LogoSidebarProps = {
variant?: "chat" | "creator";
name: 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 { variant = "chat", name, class: className } = defineProps<LogoSidebarProps>();
defineSlots<{ mark?(): unknown, actions?(): unknown }>();
</script>
<template>
<Box
:class="cn(
logoSidebarVariants({ variant: variant }),
'in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0',
className
)"
data-slot="logo-sidebar"
>
<Inline class="flex items-center gap-4" data-slot="logo-sidebar-brand">
<slot name="mark" />
<Inline class="text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden" data-slot="logo-sidebar-name">
{{ name }}
</Inline>
</Inline>
<Inline
v-if="$slots.actions"
class="flex items-center gap-2 in-data-[nav=collapsed]:hidden"
data-slot="logo-sidebar-actions"
>
<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 logo-sidebar// 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 brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The
* variant picks the padding (recipe).
*/
import { type JSX } from "solid-js";
import { Box, Inline } from "../compose";
import { cn, variants } from "../utils";
/** LogoSidebar: the classes of each value (shadcn/cva style). */
export const logoSidebarVariants = variants({
base: "flex h-8 items-center justify-between",
variants: {
variant: {
chat: "px-2",
creator: "pr-4",
},
},
defaultVariants: { variant: "chat" },
});
export type LogoSidebarProps = {
variant?: "chat" | "creator";
name: string;
class?: string;
mark?: JSX.Element;
actions?: JSX.Element;
};
export function LogoSidebar({ variant = "chat", name, class: className, mark, actions }: LogoSidebarProps) {
return (
<Box
class={cn(
logoSidebarVariants({ variant: variant }),
"in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0",
className
)}
data-slot="logo-sidebar"
>
<Inline class="flex items-center gap-4" data-slot="logo-sidebar-brand">
{mark}
<Inline class="text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden" data-slot="logo-sidebar-name">
{name}
</Inline>
</Inline>
{actions ? (
<Inline class="flex items-center gap-2 in-data-[nav=collapsed]:hidden" data-slot="logo-sidebar-actions">
{actions}
</Inline>
) : null}
</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 logo-sidebar// 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/logo-sidebar.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"
)
// LogoSidebarProps are the props of LogoSidebar; the values are the JSON shapes of the TypeScript props.
type LogoSidebarProps struct {
Variant any `json:"variant"`
Name any `json:"name"`
Class string `json:"className"`
Mark templ.Component `json:"-"`
Actions templ.Component `json:"-"`
}
// The brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The variant picks the padding (recipe).
templ LogoSidebar(p LogoSidebarProps) {
{{ vVariant := uiutils.Def(p.Variant, "chat") }}
{{ vName := p.Name }}
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: uiutils.S(uiutils.Cnv(recipeLogoSidebar.Of(map[string]any{"variant": vVariant}), "in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0", p.Class)), Attrs: uiutils.Attrs("data-slot", "logo-sidebar")}}) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex items-center gap-4", Attrs: uiutils.Attrs("data-slot", "logo-sidebar-brand")}}) {
if p.Mark != nil {
@p.Mark
}
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden", Attrs: uiutils.Attrs("data-slot", "logo-sidebar-name")}}) {
{ uiutils.Text(vName) }
}
}
if uiutils.T((p.Actions != nil)) {
@compose.Inline(compose.InlineProps{TextProps: text.TextProps{Class: "flex items-center gap-2 in-data-[nav=collapsed]:hidden", Attrs: uiutils.Attrs("data-slot", "logo-sidebar-actions")}}) {
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 logo-sidebar{#- 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/logo-sidebar.json
The brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The variant picks the padding (recipe).
Props (p): variant, name, className, mark (slot), actions (slot). -#}
{%- set v_variant = (p.variant ?? 'chat') -%}
{%- set v_name = (p.name ?? null) -%}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_slot((p.mark ?? null))|raw }}
{%- set c_1 -%}
{{ og_text(v_name) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden', 'attrs': og_attrs(['data-slot', 'logo-sidebar-name']), 'children': c_1}, with_context = false) }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'flex items-center gap-4', 'attrs': og_attrs(['data-slot', 'logo-sidebar-brand']), 'children': c_2}, with_context = false) }}
{%- if og_t(((p.actions ?? null) is not null)) %}
{%- set c_3 -%}
{{ og_slot((p.actions ?? null))|raw }}
{%- endset -%}
{{ include('compose/Inline.html.twig', {'class': 'flex items-center gap-2 in-data-[nav=collapsed]:hidden', 'attrs': og_attrs(['data-slot', 'logo-sidebar-actions']), 'children': c_3}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': og_s(og_cnv([og_recipe('blocks/recipes/logo-sidebar.variants.json', {'variant': v_variant}), 'in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0', (p.className ?? '')])), 'attrs': og_attrs(['data-slot', 'logo-sidebar']), 'children': c_4}, 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 logo-sidebar{* 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/logo-sidebar.json
The brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The variant picks the padding (recipe).
Props (p): variant, name, className, mark (slot), actions (slot). *}
{var $v_variant = ($p['variant'] ?? 'chat')}
{var $v_name = ($p['name'] ?? null)}
{capture $c_4}
{capture $c_2}
{=og_slot(($p['mark'] ?? null))|noescape}
{capture $c_1}
{=og_text($v_name)}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden', 'attrs' => og_attrs(['data-slot', 'logo-sidebar-name']), 'children' => (string) $c_1])|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'flex items-center gap-4', 'attrs' => og_attrs(['data-slot', 'logo-sidebar-brand']), 'children' => (string) $c_2])|noescape}
{if og_t(((($p['actions'] ?? null) !== null)))}
{capture $c_3}
{=og_slot(($p['actions'] ?? null))|noescape}
{/capture}
{=og_include('compose/Inline.latte', ['class' => 'flex items-center gap-2 in-data-[nav=collapsed]:hidden', 'attrs' => og_attrs(['data-slot', 'logo-sidebar-actions']), 'children' => (string) $c_3])|noescape}
{/if}
{/capture}
{=og_include('compose/Box.latte', ['class' => og_s(og_cnv([og_recipe('blocks/recipes/logo-sidebar.variants.json', ['variant' => $v_variant]), 'in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0', ($p['className'] ?? '')])), 'attrs' => og_attrs(['data-slot', 'logo-sidebar']), 'children' => (string) $c_4])|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 logo-sidebar{#- 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/logo-sidebar.json
The brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The variant picks the padding (recipe).
Props (p): variant, name, className, mark (slot), actions (slot). -#}
{%- set v_variant = og_def(p['variant'], 'chat') -%}
{%- set v_name = og_def(p['name'], none) -%}
{%- set c_4 -%}
{%- set c_2 -%}
{{ og_slot(og_def(p['mark'], none))|safe }}
{%- set c_1 -%}
{{ og_text(v_name) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'text-sm font-bold text-foreground in-data-[nav=collapsed]:hidden', 'Attrs': og_attrs(['data-slot', 'logo-sidebar-name'])}, 'children': c_1}) }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex items-center gap-4', 'Attrs': og_attrs(['data-slot', 'logo-sidebar-brand'])}, 'children': c_2}) }}
{%- if og_t((og_def(p['actions'], none) is not none)) %}
{%- set c_3 -%}
{{ og_slot(og_def(p['actions'], none))|safe }}
{%- endset -%}
{{ og_include('compose/inline.html.j2', {'p': {'Class': 'flex items-center gap-2 in-data-[nav=collapsed]:hidden', 'Attrs': og_attrs(['data-slot', 'logo-sidebar-actions'])}, 'children': c_3}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': og_s(og_cnv([og_recipe('blocks/recipes/logo-sidebar.variants.json', {'variant': v_variant}), 'in-data-[nav=collapsed]:w-full in-data-[nav=collapsed]:justify-center in-data-[nav=collapsed]:p-0', og_def(p['className'], '')])), 'Attrs': og_attrs(['data-slot', 'logo-sidebar'])}, 'children': c_4}) }}
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 brand row of a sidebar: a mark and the product name on the left, trailing actions on the right. The variant picks the padding (recipe).
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "chat" | "creator" | "chat" | padding of the row |
| name (required) | string | - | product name |