Skip to content
  1. Keyline UI
  2. Notice
Keyline UIComponents
  • Get started
    • Installation
    • Theming
    • Modes
    • Configuration
    • Composition
  • Actions
    • Button
    • Button group
    • Split button
    • Toggle
    • Toggle group
    • Toolbar
    • Menu
    • Menubar
    • Context menu
  • Inputs
    • Field and form
    • Checkbox
    • Checkbox group
    • Radio group
    • Switch
    • Slider
    • Segmented
    • Select
    • Native select
    • Combobox
    • Multiselect
    • Number field
    • OTP field
    • Time field
    • Date picker and calendar
    • Date range
  • Data
    • Table
    • Chart
    • Stat and meter
    • Status and badge
    • Progress
    • Skeleton
    • Empty
    • Avatar
    • Kbd
    • Marker
  • Navigation
    • Tabs
    • Breadcrumb
    • Pagination
    • Nav
    • Navigation menu
    • Command menu
  • Overlays
    • Dialog
    • Alert dialog
    • Drawer
    • Sheet
    • Popover
    • Hover card
    • Tooltip
    • Toast
    • Notice
  • Layout
    • App shell
    • Sidebar
    • Panel
    • Resizable
    • Scroll area
    • Accordion
    • Collapsible
    • Carousel
    • Inspector
    • Item
    • Direction
  • Conversation
    • Message
    • Bubble
    • Message scroller
    • Attachment
    • Questionnaire
  • Blocks
    • Shipments

Notice

An inline message about the place it sits in. Its signal cell carries the tone as a shape and a colour, and its actions are cells on the same keylines. It never floats: a toast records something that happened, a notice describes something that is still true.

Loading the live example…

"use client"

import { useState } from "react"
import { Button } from "@/components/keyline/ui/button"
import { Notice } from "@/components/keyline/ui/notice"

export function PaperStock() {
  const [state, setState] = useState<"low" | "ordered" | "gone">("low")

  return (
    <div className="grid gap-3">
      <Notice
        open={state !== "gone"}
        live={state === "ordered"}
        tone={state === "low" ? "attention" : "done"}
        title={state === "low" ? "Letter paper is down to 30 cases" : "120 cases reordered from the mill"}
        description={
          state === "low" ? "That covers two days of deliveries. Darryl needs a week's notice." : "They arrive Thursday. Darryl has the dock booked."
        }
        actions={
          state === "low" ? (
            <Button layout="cell" variant="primary" onClick={() => setState("ordered")}>
              Reorder 120 cases
            </Button>
          ) : null
        }
        onDismiss={state === "ordered" ? () => setState("gone") : undefined}
      />
      {state === "gone" ? (
        <Button size="compact" variant="quiet" className="justify-self-start" onClick={() => setState("low")}>
          Show the warning again
        </Button>
      ) : null}
    </div>
  )
}

Installation

npx shadcn@latest add @keyline-ui/notice

Run it where your components.json is. The first time, map the @keyline-ui registry: one command, in Installation.

Usage

import { Notice } from "@/components/keyline/ui/notice"
<Notice
  tone="attention"
  title="Letter paper is down to 30 cases"
  description="That covers two days of deliveries."
  actions={<Button layout="cell" variant="primary">Reorder</Button>}
/>

Props

PropTypeDefaultDescription
tone"info" | "done" | "attention" | "neutral"Default "info"The signal cell: i, ✓, ! or a plain rule.
title · descriptionReactNodeDefault —The condition, then what it means or what to do.
actionsReactNodeDefault —Buttons with layout="cell". They wrap below the message on a narrow width.
onDismiss() => voidDefault —Adds a close cell.
openbooleanDefault truefalse folds it back to its top keyline and makes it inert, so it can animate away.
livebooleanDefault falseAnnounces it when it appears. Use it for the result of something the reader just did.
layout"control" | "cell"Default "control"cell is a row of an enclosing frame, such as the top of a panel.

The signal is a shape as well as a colour, so it reads without colour vision. For a record of something that just happened, use Toast.

Sheet 56 of 73PreviousToastNextApp shell
On this page