Notice
Notice component
Install
npx ui8kit add noticePulls in: box, compose, kit-box, kit-text, lucide-icon, 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 notice<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text
renders nothing visible.
-->
<script lang="ts" module>
import type { Snippet } from "svelte";
export type NoticeProps = {
text: string;
};
</script>
<script lang="ts">
import Box from "../compose/Box.svelte";
import LucideIcon from "../icons/LucideIcon.svelte";
import Text from "../compose/Text.svelte";
let { text }: NoticeProps = $props();
</script>
<Box class="contents" role="status" data-slot="notice">
{#if text}
<Text
class={"fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold " +
"text-background shadow-lg"}
>
<LucideIcon name="circle-check" size={16} />
{text}
</Text>
{/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 notice// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text
* renders nothing visible.
*/
import { type ReactNode } from "react";
import { Box, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
export type NoticeProps = {
text: string;
};
export function Notice({ text }: NoticeProps) {
return (
<Box className="contents" role="status" data-slot="notice">
{text ? (
<Text
className={"fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold " +
"text-background shadow-lg"}
>
<LucideIcon name="circle-check" size={16} />
{text}
</Text>
) : 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 notice<!-- Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT. -->
<!--
A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text
renders nothing visible.
-->
<script lang="ts">
export type NoticeProps = {
text: string;
};
</script>
<script setup lang="ts">
import Box from "../compose/Box.vue";
import LucideIcon from "../icons/LucideIcon.vue";
import Text from "../compose/Text.vue";
const { text } = defineProps<NoticeProps>();
</script>
<template>
<Box class="contents" role="status" data-slot="notice">
<Text v-if="text"
:class="'fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold ' +
'text-background shadow-lg'"
>
<LucideIcon name="circle-check" :size="16" />
{{ text }}
</Text>
</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 notice// Code generated by packages/kit-compose/src/organisms.ts from packages/compose-gen/specs (compose-gen organism emitters on kit-compose). DO NOT EDIT.
/**
* A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text
* renders nothing visible.
*/
import { type JSX } from "solid-js";
import { Box, Text } from "../compose";
import { LucideIcon } from "../icons/LucideIcon";
export type NoticeProps = {
text: string;
};
export function Notice({ text }: NoticeProps) {
return (
<Box class="contents" role="status" data-slot="notice">
{text ? (
<Text
class={"fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold " +
"text-background shadow-lg"}
>
<LucideIcon name="circle-check" size={16} />
{text}
</Text>
) : 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 notice// 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/notice.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/icons"
"github.com/ui8kit/codegen/generated/templ/ui/text"
uiutils "github.com/ui8kit/codegen/generated/templ/orgutils"
)
// NoticeProps are the props of Notice; the values are the JSON shapes of the TypeScript props.
type NoticeProps struct {
Text any `json:"text"`
}
// A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text renders nothing visible.
templ Notice(p NoticeProps) {
{{ vText := p.Text }}
@compose.Box(compose.BoxProps{BoxProps: box.BoxProps{Class: "contents", Attrs: uiutils.Attrs("role", "status", "data-slot", "notice")}}) {
if uiutils.T(vText) {
@compose.Text(compose.TextProps{TextProps: text.TextProps{Class: "fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold text-background shadow-lg"}}) {
@icons.LucideIcon(icons.LucideIconProps{Name: "circle-check", Size: 16})
{ uiutils.Text(vText) }
}
}
}
}
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 notice{#- 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/notice.json
A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text renders nothing visible.
Props (p): text. -#}
{%- set v_text = (p.text ?? null) -%}
{%- set c_2 -%}
{%- if og_t(v_text) %}
{%- set c_1 -%}
{{ include('icons/LucideIcon.html.twig', {'name': 'circle-check', 'size': 16}, with_context = false) }}
{{ og_text(v_text) }}
{%- endset -%}
{{ include('compose/Text.html.twig', {'class': 'fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold text-background shadow-lg', 'children': c_1}, with_context = false) }}
{%- endif %}
{%- endset -%}
{{ include('compose/Box.html.twig', {'class': 'contents', 'attrs': og_attrs(['role', 'status', 'data-slot', 'notice']), 'children': c_2}, 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 notice{* 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/notice.json
A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text renders nothing visible.
Props (p): text. *}
{var $v_text = ($p['text'] ?? null)}
{capture $c_2}
{if og_t($v_text)}
{capture $c_1}
{=og_include('icons/LucideIcon.latte', ['name' => 'circle-check', 'size' => 16])|noescape}
{=og_text($v_text)}
{/capture}
{=og_include('compose/Text.latte', ['class' => 'fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold text-background shadow-lg', 'children' => (string) $c_1])|noescape}
{/if}
{/capture}
{=og_include('compose/Box.latte', ['class' => 'contents', 'attrs' => og_attrs(['role', 'status', 'data-slot', 'notice']), 'children' => (string) $c_2])|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 notice{#- 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/notice.json
A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text renders nothing visible.
Props (p): text. -#}
{%- set v_text = og_def(p['text'], none) -%}
{%- set c_2 -%}
{%- if og_t(v_text) %}
{%- set c_1 -%}
{{ og_include('icons/lucide-icon.html.j2', {'p': {'Name': 'circle-check', 'Size': 16}}) }}
{{ og_text(v_text) }}
{%- endset -%}
{{ og_include('compose/text.html.j2', {'p': {'Class': 'fixed right-4 bottom-4 z-40 m-0 flex items-center gap-2 rounded bg-foreground p-4 text-xs font-bold text-background shadow-lg'}, 'children': c_1}) }}
{%- endif %}
{%- endset -%}
{{ og_include('compose/box.html.j2', {'p': {'Class': 'contents', 'Attrs': og_attrs(['role', 'status', 'data-slot', 'notice'])}, 'children': c_2}) }}
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.
A short confirmation toast: fixed bottom right, read out by screen readers through role status. Empty text renders nothing visible.
| Prop | Type | Default | Description |
|---|---|---|---|
| text (required) | string | - |