Overlays

Dialog

Interrupts the page for a focused task, as a centered modal or a sheet from the side.

Installation

npx sinaui add dialog

Examples

Centered, with a title, description and footer actions. Clicking the backdrop or pressing Escape closes it.

Edit scholar

Changes appear in the House of Wisdom catalog right away.

Astrolabe maker, Aleppo, 10th century.

Side sheet

side="start" slides in from the reading-start edge, and from the right in right-to-left pages. The docs' mobile navigation uses it.

Reading rooms

Where the manuscripts are kept.

  • Bayt al-Hikma, Baghdad
  • Library of Córdoba
  • Al-Qarawiyyin, Fez
<script lang="ts">
	import Button from '#lib/ui/Button.svelte';
	import Dialog from '#lib/ui/Dialog.svelte';

	let open = $state(false);
</script>

<Button variant="secondary" onclick={() => (open = true)}>Open reading rooms</Button>
<Dialog bind:open side="start" title="Reading rooms" description="Where the manuscripts are kept.">
	<ul>
		<li>Bayt al-Hikma, Baghdad</li>
		<li>Library of Córdoba</li>
		<li>Al-Qarawiyyin, Fez</li>
	</ul>
</Dialog>

Props

PropTypeDefault
openboolean, bindablefalse
titlestring (required)
descriptionstring
side'center' | 'start''center'
closeLabelstring'Close'
footerSnippet

Accessibility

  • Built on <dialog> with showModal(): focus stays inside, the page behind is inert, and focus returns to the trigger on close.
  • Labeled by its title and described by its description.
  • Dragging a text selection out onto the backdrop doesn't close it.
  • Add autofocus to the field that should receive focus when it opens. Translate closeLabel for non-English interfaces.
KeyAction
Tab / Shift TabMoves between controls inside the dialog.
EscapeCloses the dialog and returns focus.
Introduction
Theming
Changelog
Button
Action button
Confirm button
Copy button
Hold to confirm
Split button
Calendar
Checkbox
Color picker
Combobox
Date picker
Date range picker
File drop
Form
Input
Mention input
Multi select
Number field
OTP input
Password input
Phone input
Radio cards
Radio group
Rich text editor
Search field
Segmented control
Select
Signature pad
Slider
Switch
Tag input
Upload
Wheel picker
Textarea
Time field
Toggle group
Toolbar
Alert dialog
Command palette
Context menu
Dialog
Drawer
Dropdown
Hover card
Popover
Tooltip
Announcement bar
Alert
Empty state
Meter
Progress
Rolling number
Skeleton
Spinner
Toast
Avatar
Avatar group
Badge
Card
Carousel
Chart
Chat
Code block
Data table
Folder
Kbd
Mind map
Resizable panels
Scroll area
Separator
Sortable
Table
Tag group
Virtual list
Audio player
Image
Image compare
Video
Visualizer
Breadcrumb
File tree
Menubar
Navigation menu
Pagination
Sidebar layout
Stepper
Tabs
Alarm clock
Clock
Dynamic island
Fluid orb
Hourglass
Stopwatch
Timer
AI chat
AI media
Auth
Board
Booking
Dashboard
File explorer
Messaging
Notifications
Settings
Team
Overview
Pricing
Agent chat
Calendar
Voice agent
Mail inbox
CMS
Blog
Marketing site
E-commerce
AI agents
SaaS landing page
SaaS app
Accordion
Dark theme
Light theme