Components
- Accordion
- Alert
- Alert Dialog
- Aspect Ratio
- Attachment
- Avatar
- Badge
- Breadcrumb
- Bubble
- Button
- Button Group
- Calendar
- Card
- Carousel
- Chart
- Checkbox
- Collapsible
- Combobox
- Command
- Context Menu
- Data Table
- Date Picker
- Dialog
- Direction
- Drawer
- Dropdown Menu
- Empty
- Field
- Hover Card
- Input
- Input Group
- Input OTP
- Item
- Kbd
- Label
- Marker
- Menubar
- Message
- Message Scroller
- Native Select
- Navigation Menu
- Pagination
- Popover
- Progress
- Questionnaire
- Radio Group
- Resizable
- Scroll Area
- Select
- Separator
- Sheet
- Sidebar
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Tooltip
- Typography
Sections
@shadcn/react
@shadcn/helpers
Utilities
"use client"
import { Button } from "@/components/ui/base/button"インストール#
次のコマンドを実行します。
pnpm dlx shadcn@latest add toast
トースター コンポーネントを追加します。
import { Toaster } from "@/components/ui/toast"
export default function RootLayout({ children }) {
return (
<html lang="en">
<body>
<main>{children}</main>
<Toaster />
</body>
</html>
)
}使用法#
import { toast } from "@/components/ui/toast"toast.add({
title: "Event created",
description: "Sunday, December 3 at 9:00 AM",
})種類#
ステータス アイコンを表示するには、type オプションを設定します。組み込みレンダラーは success、info、warning、error、loading を認識します。
"use client"
import { Button } from "@/components/ui/base/button"アクション#
actionProps にボタンのプロップを渡すと、アクションがレンダリングされます。
const id = toast.add({
title: "Event created",
actionProps: {
children: "Undo",
onClick() {
toast.close(id)
},
},
})プロミス#
toast.promise を使用すると、非同期タスクが読み込み中、成功、エラーの各状態へと移行するのに合わせて、1 つのトーストを更新できます。
"use client"
import { Button } from "@/components/ui/base/button"API リファレンス#
マネージャー オプション、スタッキング、スワイプによる閉じ方、プリミティブ API の詳細については、Base UI Toast ドキュメント を参照してください。
shadcn/uiアプリをVercelにデプロイ
OpenAI、Sonos、Adobeなどに採用されています。
Vercelは、アプリや機能を大規模にデプロイするためのツールと インフラを提供します。
Vercelにデプロイ