Footer Columns
Footer Columns component
Install
npx ui8kit add footer-columnsPulls in: block, compose, grid, kit-box, kit-text, list, list-item, mega-menu, menu-entry, stack, text, 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 footer-columns<!-- 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 link groups of SitemapFooter as columns: a group title over its links, up to five columns. -->
<script lang="ts" module>
import type { Snippet } from "svelte";
import type { MegaGroup } from "../blocks/mega-menu.types";
export type FooterColumnsProps = {
label: string;
groups: MegaGroup[];
landmarkLabel?: string;
};
</script>
<script lang="ts">
import Block from "../compose/Block.svelte";
import Grid from "../compose/Grid.svelte";
import List from "../compose/List.svelte";
import ListItem from "../compose/ListItem.svelte";
import Stack from "../compose/Stack.svelte";
import Text from "../compose/Text.svelte";
import MenuEntry from "../components/menu-entry.svelte";
let { label, groups, landmarkLabel }: FooterColumnsProps = $props();
</script>
{#if ((groups?.length ?? 0) > 0)}
<Block tag="nav" aria-label={(landmarkLabel ?? label)} data-slot="footer-columns">
<Grid cols="1" class="grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5" data-slot="footer-groups">
{#each groups as g (g.id)}
<Stack gap="2" data-slot="group">
<Text size="sm" weight="semibold">
{g.title}
</Text>
<List class="m-0 flex list-none flex-col gap-2 p-0">
{#each g.links as item (item.id)}
<ListItem data-slot="links-row">
<MenuEntry href={item.href} class="text-sm text-muted-foreground">
{item.name}
</MenuEntry>
</ListItem>
{/each}
</List>
</Stack>
{/each}
</Grid>
</Block>
{/if}
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 footer-columns// 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 link groups of SitemapFooter as columns: a group title over its links, up to five columns. */
import { type ReactNode } from "react";
import { Block, Grid, List, ListItem, Stack, Text } from "../compose";
import { MenuEntry } from "../components/menu-entry";
import type { MegaGroup } from "../blocks/mega-menu.types";
export type FooterColumnsProps = {
label: string;
groups: MegaGroup[];
landmarkLabel?: string;
};
export function FooterColumns({ label, groups, landmarkLabel }: FooterColumnsProps) {
return (
<>
{((groups?.length ?? 0) > 0) ? (
<Block tag="nav" aria-label={(landmarkLabel ?? label)} data-slot="footer-columns">
<Grid cols="1" className="grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5" data-slot="footer-groups">
{(groups ?? []).map((g) => (
<Stack key={g.id} gap="2" data-slot="group">
<Text size="sm" weight="semibold">
{g.title}
</Text>
<List className="m-0 flex list-none flex-col gap-2 p-0">
{(g.links ?? []).map((item) => (
<ListItem key={item.id} data-slot="links-row">
<MenuEntry href={item.href} className="text-sm text-muted-foreground">
{item.name}
</MenuEntry>
</ListItem>
))}
</List>
</Stack>
))}
</Grid>
</Block>
) : null}
</>
);
}
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 footer-columns<!-- 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 link groups of SitemapFooter as columns: a group title over its links, up to five columns. -->
<script lang="ts">
import type { MegaGroup } from "../blocks/mega-menu.types";
export type FooterColumnsProps = {
label: string;
groups: MegaGroup[];
landmarkLabel?: string;
};
</script>
<script setup lang="ts">
import Block from "../compose/Block.vue";
import Grid from "../compose/Grid.vue";
import List from "../compose/List.vue";
import ListItem from "../compose/ListItem.vue";
import Stack from "../compose/Stack.vue";
import Text from "../compose/Text.vue";
import MenuEntry from "../components/menu-entry.vue";
const { label, groups, landmarkLabel } = defineProps<FooterColumnsProps>();
</script>
<template>
<Block
v-if="((groups?.length ?? 0) > 0)"
tag="nav"
:aria-label="(landmarkLabel ?? label)"
data-slot="footer-columns"
>
<Grid cols="1" class="grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5" data-slot="footer-groups">
<Stack v-for="g in groups" :key="g.id" gap="2" data-slot="group">
<Text size="sm" weight="semibold">
{{ g.title }}
</Text>
<List class="m-0 flex list-none flex-col gap-2 p-0">
<ListItem v-for="item in g.links" :key="item.id" data-slot="links-row">
<MenuEntry :href="item.href" class="text-sm text-muted-foreground">
{{ item.name }}
</MenuEntry>
</ListItem>
</List>
</Stack>
</Grid>
</Block>
</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 footer-columns// 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 link groups of SitemapFooter as columns: a group title over its links, up to five columns. */
import { For, type JSX } from "solid-js";
import { Block, Grid, List, ListItem, Stack, Text } from "../compose";
import { MenuEntry } from "../components/menu-entry";
import type { MegaGroup } from "../blocks/mega-menu.types";
export type FooterColumnsProps = {
label: string;
groups: MegaGroup[];
landmarkLabel?: string;
};
export function FooterColumns({ label, groups, landmarkLabel }: FooterColumnsProps) {
return (
<>
{((groups?.length ?? 0) > 0) ? (
<Block tag="nav" aria-label={(landmarkLabel ?? label)} data-slot="footer-columns">
<Grid cols="1" class="grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5" data-slot="footer-groups">
<For each={groups ?? []}>{(g) => (
<Stack gap="2" data-slot="group">
<Text size="sm" weight="semibold">
{g.title}
</Text>
<List class="m-0 flex list-none flex-col gap-2 p-0">
<For each={g.links ?? []}>{(item) => (
<ListItem data-slot="links-row">
<MenuEntry href={item.href} class="text-sm text-muted-foreground">
{item.name}
</MenuEntry>
</ListItem>
)}</For>
</List>
</Stack>
)}</For>
</Grid>
</Block>
) : null}
</>
);
}
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 footer-columns// 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/organisms/footer-columns.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"
)
// FooterColumnsProps are the props of FooterColumns; the values are the JSON shapes of the TypeScript props.
type FooterColumnsProps struct {
Label any `json:"label"`
Groups any `json:"groups"`
LandmarkLabel any `json:"landmarkLabel"`
}
// The link groups of SitemapFooter as columns: a group title over its links, up to five columns.
templ FooterColumns(p FooterColumnsProps) {
{{ vLabel := p.Label }}
{{ vGroups := p.Groups }}
{{ vLandmarkLabel := p.LandmarkLabel }}
if uiutils.Gt(uiutils.Len(vGroups), float64(0)) {
@compose.Block(compose.BlockProps{BoxProps: box.BoxProps{Tag: "nav", Attrs: uiutils.Attrs("aria-label", uiutils.Coalesce(vLandmarkLabel, vLabel), "data-slot", "footer-columns")}}) {
@compose.Grid(compose.GridProps{Cols: "1", BoxProps: box.BoxProps{Class: "grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5", Attrs: uiutils.Attrs("data-slot", "footer-groups")}}) {
for _, vG := range uiutils.L(vGroups) {
@compose.Stack(compose.StackProps{Gap: "2", BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "group")}}) {
@compose.Text(compose.TextProps{Size: "sm", Weight: "semibold", TextProps: text.TextProps{}}) {
{ uiutils.Text(uiutils.Get(vG, "title")) }
}
@compose.List(compose.ListProps{BoxProps: box.BoxProps{Class: "m-0 flex list-none flex-col gap-2 p-0"}}) {
for _, vItem := range uiutils.L(uiutils.Get(vG, "links")) {
@compose.ListItem(compose.ListItemProps{BoxProps: box.BoxProps{Attrs: uiutils.Attrs("data-slot", "links-row")}}) {
@MenuEntry(MenuEntryProps{Href: uiutils.Get(vItem, "href"), Class: uiutils.Cnv("text-sm text-muted-foreground")}) {
{ uiutils.Text(uiutils.Get(vItem, "name")) }
}
}
}
}
}
}
}
}
}
}
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 footer-columns{#- 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/organisms/footer-columns.json
The link groups of SitemapFooter as columns: a group title over its links, up to five columns.
Props (p): label, groups, landmarkLabel. -#}
{%- set v_label = (p.label ?? null) -%}
{%- set v_groups = (p.groups ?? null) -%}
{%- set v_landmarkLabel = (p.landmarkLabel ?? null) -%}
{%- if og_t(og_gt(og_len(v_groups), 0)) %}
{%- set c_7 -%}
{%- set c_6 -%}
{%- for v_g in og_l(v_groups) %}
{%- set c_5 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_g, ['title'])) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'size': 'sm', 'weight': 'semibold', 'children': c_1}, with_context = false) }}
{%- set c_4 -%}
{%- for v_item in og_l(og_get(v_g, ['links'])) %}
{%- set c_3 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_item, ['name'])) }}
{%- endset -%}
{{ include('blocks/menu-entry.html.twig', {'p': {'href': og_get(v_item, ['href']), 'className': og_cnv(['text-sm text-muted-foreground'])}, 'children': og_markup(c_2)}, with_context = false) }}
{%- endset -%}
{{ include('compose/ListItem.html.twig', {'attrs': og_attrs(['data-slot', 'links-row']), 'children': c_3}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/List.html.twig', {'class': 'm-0 flex list-none flex-col gap-2 p-0', 'children': c_4}, with_context = false) }}
{%- endset -%}
{{ include('compose/Stack.html.twig', {'gap': '2', 'attrs': og_attrs(['data-slot', 'group']), 'children': c_5}, with_context = false) }}
{%- endfor %}
{%- endset -%}
{{ include('compose/Grid.html.twig', {'cols': '1', 'class': 'grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5', 'attrs': og_attrs(['data-slot', 'footer-groups']), 'children': c_6}, with_context = false) }}
{%- endset -%}
{{ include('compose/Block.html.twig', {'tag': 'nav', 'attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, v_label]), 'data-slot', 'footer-columns']), 'children': c_7}, with_context = false) }}
{%- endif %}
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 footer-columns{* 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/organisms/footer-columns.json
The link groups of SitemapFooter as columns: a group title over its links, up to five columns.
Props (p): label, groups, landmarkLabel. *}
{var $v_label = ($p['label'] ?? null)}
{var $v_groups = ($p['groups'] ?? null)}
{var $v_landmarkLabel = ($p['landmarkLabel'] ?? null)}
{if og_t(og_gt(og_len($v_groups), 0))}
{capture $c_7}
{capture $c_6}
{foreach og_l($v_groups) as $v_g}
{capture $c_5}
{capture $c_1}
{=og_text(og_get($v_g, ['title']))}
{/capture}
{=og_include('compose/Text.latte', ['size' => 'sm', 'weight' => 'semibold', 'children' => (string) $c_1])|noescape}
{capture $c_4}
{foreach og_l(og_get($v_g, ['links'])) as $v_item}
{capture $c_3}
{capture $c_2}
{=og_text(og_get($v_item, ['name']))}
{/capture}
{=og_include('blocks/menu-entry.latte', ['p' => ['href' => og_get($v_item, ['href']), 'className' => og_cnv(['text-sm text-muted-foreground'])], 'children' => og_markup($c_2)])|noescape}
{/capture}
{=og_include('compose/ListItem.latte', ['attrs' => og_attrs(['data-slot', 'links-row']), 'children' => (string) $c_3])|noescape}
{/foreach}
{/capture}
{=og_include('compose/List.latte', ['class' => 'm-0 flex list-none flex-col gap-2 p-0', 'children' => (string) $c_4])|noescape}
{/capture}
{=og_include('compose/Stack.latte', ['gap' => '2', 'attrs' => og_attrs(['data-slot', 'group']), 'children' => (string) $c_5])|noescape}
{/foreach}
{/capture}
{=og_include('compose/Grid.latte', ['cols' => '1', 'class' => 'grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5', 'attrs' => og_attrs(['data-slot', 'footer-groups']), 'children' => (string) $c_6])|noescape}
{/capture}
{=og_include('compose/Block.latte', ['tag' => 'nav', 'attrs' => og_attrs(['aria-label', og_coalesce([$v_landmarkLabel, $v_label]), 'data-slot', 'footer-columns']), 'children' => (string) $c_7])|noescape}
{/if}
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 footer-columns{#- 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/organisms/footer-columns.json
The link groups of SitemapFooter as columns: a group title over its links, up to five columns.
Props (p): label, groups, landmarkLabel. -#}
{%- set v_label = og_def(p['label'], none) -%}
{%- set v_groups = og_def(p['groups'], none) -%}
{%- set v_landmarkLabel = og_def(p['landmarkLabel'], none) -%}
{%- if og_t(og_gt(og_len(v_groups), 0)) %}
{%- set c_7 -%}
{%- set c_6 -%}
{%- for v_g in og_l(v_groups) %}
{%- set c_5 -%}
{%- set c_1 -%}
{{ og_text(og_get(v_g, ['title'])) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Size': 'sm', 'Weight': 'semibold'}, 'children': c_1}) }}
{%- set c_4 -%}
{%- for v_item in og_l(og_get(v_g, ['links'])) %}
{%- set c_3 -%}
{%- set c_2 -%}
{{ og_text(og_get(v_item, ['name'])) }}
{%- endset -%}
{{ og_include('blocks/menu-entry.html.j2', {'p': {'href': og_get(v_item, ['href']), 'className': og_cnv(['text-sm text-muted-foreground'])}, 'children': og_markup(c_2)}) }}
{%- endset -%}
{{ og_include('compose/list-item.html.j2', {'p': {'Attrs': og_attrs(['data-slot', 'links-row'])}, 'children': c_3}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/list.html.j2', {'p': {'Class': 'm-0 flex list-none flex-col gap-2 p-0'}, 'children': c_4}) }}
{%- endset -%}
{{ og_include('compose/stack.html.j2', {'p': {'Gap': '2', 'Attrs': og_attrs(['data-slot', 'group'])}, 'children': c_5}) }}
{%- endfor %}
{%- endset -%}
{{ og_include('compose/grid.html.j2', {'p': {'Cols': '1', 'Class': 'grid-cols-1 gap-8 sm:grid-cols-2 lg:grid-cols-5', 'Attrs': og_attrs(['data-slot', 'footer-groups'])}, 'children': c_6}) }}
{%- endset -%}
{{ og_include('compose/block.html.j2', {'p': {'Tag': 'nav', 'Attrs': og_attrs(['aria-label', og_coalesce([v_landmarkLabel, v_label]), 'data-slot', 'footer-columns'])}, 'children': c_7}) }}
{%- endif %}
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 link groups of SitemapFooter as columns: a group title over its links, up to five columns.
| Prop | Type | Default | Description |
|---|---|---|---|
| label (required) | string | - | accessible name of the link groups |
| groups (required) | MegaGroup[] | - | |
| 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 |