Feedback

Toast.

A brief confirmation that stays out of the way.

LIVE PREVIEWTry it. It works.

Install the source

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/toast.json

Registry setup · Examples · API and behavior · Open the playground

COMPLETE EXAMPLES

Use it in context.

Each example includes its imports, data and state. The preview runs that same source. Include the stylesheet once in your application.

Announce a local action

The provider owns notification lifetime; the action does not pretend to save remotely.

Loads this example when you need it.

Keyboard

  • Tab reaches the action and notification close control.

States covered

  • No notification
  • Visible notification
  • Dismissed

Install this complete example and its component dependencies.

Terminal
npx shadcn@latest add https://ui.bld8.dev/r/example-basic-toast.json
Complete source
React / TypeScript
/*!
MIT License

Copyright (c) 2026 Jaison

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
'use client';
import {Button,UIProvider,useToast} from '@bld8/ui';
import '@bld8/ui/styles.css';
function NoticeAction(){const toast=useToast();return <Button onClick={()=>toast.add({title:'Example preference changed',description:'The notification is local to this page.'})}>Show example notification</Button>;}
export default function ToastExample(){return <UIProvider><NoticeAction/></UIProvider>;}

Quick reference

React / TypeScript
const toast = useToast();
<Button onClick={() => toast.add({title:"Saved",description:"Your changes are up to date."})}>Save</Button>

In the workspace or ZIP starter, import components from @bld8/ui and include @bld8/ui/styles.css once. Registry installations use your local bld8/ source path. Wrap overlays in UIProvider.

API & behaviour

UIProvider supplies Base UI Toast context and the viewport. Optional local theme, tokens, locale, direction, messages, motion and portalContainer scope a workspace and its portals without changing the document. useToast exposes its manager including add, update and close. Default timeout is five seconds, with at most three visible notifications.

UIProvider

UIProvider public properties
PropTypeDefault
childrenRequiredReactNode—
classNamestring | undefined—
direction"ltr" | "rtl" | undefined—
localestring | undefined—
messagesReadonly<Record<string, string>> | undefined—
motion"system" | "reduced" | undefined

Reduced motion cannot override a system preference requesting less motion.

—
portalContainerUIPortalContainer | undefined—
styleCSSProperties | undefined—
theme"light" | "dark" | undefined—
tokensPartial<Record<`--bui-${string}`, string | number>> | undefined—

UIConfigOptions

UIConfigOptions public properties
PropTypeDefault
direction"ltr" | "rtl" | undefined—
localestring | undefined—
messagesReadonly<Record<string, string>> | undefined—
motion"system" | "reduced" | undefined

Reduced motion cannot override a system preference requesting less motion.

—
portalContainerUIPortalContainer | undefined—
theme"light" | "dark" | undefined—
tokensPartial<Record<`--bui-${string}`, string | number>> | undefined—

UIConfig

UIConfig public properties
PropTypeDefault
directionRequired"ltr" | "rtl"—
localeRequiredstring—
messageRequired(key: string, fallback: string, values?: Record<string, string | number>) => string—
motionRequired"system" | "reduced"—
overridesRequiredReadonly<Record<string, string>>—
scopedRequiredboolean—
tokensRequiredPartial<Record<`--bui-${string}`, string | number>>—
portalContainerUIPortalContainer | undefined—
theme"light" | "dark" | undefined—

UIMessages

Readonly<Record<string,string>>

UITokens

Partial<Record<`--bui-${string}`,string|number>>

Tables come from the public TypeScript declarations. Related types and function parameters are shown alongside their component. A dash means no default is declared at the public function boundary.

Related controls

Notes to self

Test this component with real content, keyboard input and both themes. The example is a starting point; labels, error handling and behaviour still need to fit the application.