Getting StartedInstallationSupportChangelogGithubFrameworksAngularVueReactDemosFoundationThemesInternationalizationTypographyIconsLayoutGetting StartedBlockInlineGridComponentsAccordionAlertAlert GroupBadgeBreadcrumbButtonButton GroupButton ExpandButton HandleButton IconButton Icon GroupButton SortCardCheckboxColorData GridDateDialogDividerDrawerDropdownFileFormsForm InteractionsForm ValidationHeaderInputMenuMonthNavPaginationPasswordProgress BarProgress CircleRadioRangeSearchSelectShellSwitchTabsTagTextareaTimeToastTooltipData GridGetting StartedFooterPlaceholderAsyncResponsiveScroll HeightPaginationBordersHoverColumn AlignmentColumn WidthColumn FixedColumn StickyColumn VisibilityRow HeaderRow Multi SelectRow Single SelectRow HeightRow ActionRow Action BulkRow StickyRow StripeRow FixedRow SortRow Groups

The dialog component is used to display content in a overlay that appears on top of the current view. It is used to display information that requires the user's attention or interaction. The dialog should have a clear and concise title that describes its purpose. The content of the dialog should be easy to read and understand, and should include clear call-to-action buttons.

Example

open dialog
code
<bp-button id="btn">open dialog</bp-button>
<bp-dialog hidden modal closable trigger="btn">
<h2 slot="header" bp-text="section">Dialog Header</h2>
<p bp-text="content">dialog content</p>
<div slot="footer" bp-layout="inline gap:xs inline:end">
<bp-button action="outline">Cancel</bp-button>
<bp-button>Save</bp-button>
</div>
</bp-dialog>

<script type="module">
import '@blueprintui/components/include/dialog.js';
import '@blueprintui/components/include/button.js';

const dialog = document.querySelector('bp-dialog');
dialog.addEventListener('close', () => (dialog.hidden = true));
dialog.addEventListener('open', () => (dialog.hidden = false));
</script>

Small

open small dialog
code
<bp-button id="btn-small-dialog">open small dialog</bp-button>
<bp-dialog hidden modal closable trigger="btn-small-dialog" size="sm">
<h2 slot="header" bp-text="section">Size Small</h2>
<p bp-text="content">dialog content</p>
<div slot="footer" bp-layout="inline gap:xs inline:end">
<bp-button action="outline">Cancel</bp-button>
<bp-button>Save</bp-button>
</div>
</bp-dialog>

<script type="module">
import '@blueprintui/components/include/dialog.js';
import '@blueprintui/components/include/button.js';

const dialog = document.querySelector('bp-dialog[size=sm]');
dialog.addEventListener('close', () => (dialog.hidden = true));
dialog.addEventListener('open', () => (dialog.hidden = false));
</script>

Large

open large dialog
code
<bp-button id="btn-large-dialog">open large dialog</bp-button>
<bp-dialog hidden modal closable trigger="btn-large-dialog" size="lg">
<h2 slot="header" bp-text="section">Size Large</h2>
<p bp-text="content">dialog content</p>
<div slot="footer" bp-layout="inline gap:xs inline:end">
<bp-button action="outline">Cancel</bp-button>
<bp-button>Save</bp-button>
</div>
</bp-dialog>

<script type="module">
import '@blueprintui/components/include/dialog.js';
import '@blueprintui/components/include/button.js';

const dialog = document.querySelector('bp-dialog[size=lg]');
dialog.addEventListener('close', () => (dialog.hidden = true));
dialog.addEventListener('open', () => (dialog.hidden = false));
</script>

Install

NPM

// npm package
import '@blueprintui/components/include/dialog.js';

CDN

<script type="module">
import 'https://cdn.jsdelivr.net/npm/@blueprintui/components/include/dialog.js/+esm';
</script>

Accessibility

  • Provide clear and visible labels for all interactive elements, such as buttons and form fields.
  • Ensure that the dialog can be navigated and operated with the keyboard, such as using the tab key to move between elements and the enter or space key to activate buttons.
  • Ensure that the dialog is not the only way to access the content or functionality it provides, and that it can be closed easily by the user.

bp-dialog

Properties

NameTypesDescription
size'sm' | 'md' | 'lg'
positionPosition
closableboolean
triggerHTMLElement | string
modalboolean
i18n
hiddenboolean

Attributes

NameTypesDescription
size'sm' | 'md' | 'lg'
positionPosition
closableboolean
triggerHTMLElement | string
modalboolean
i18n
hiddenboolean

CSS Properties

NameTypesDescription
--padding
--filter
--background
--color
--width
--height
--min-width
--min-height
--font-size
--internal-offset-margin
--animation-duration

Slots

NameTypesDescription
defaultslot for dialog content
headerslot for dialog header
footerslot for dialog footer