Alerts And Dialogs




Dialog

Simple


For the Rails version of the dialog kit, the clickable element being used to open the dialog must be given a open-dialog data attribute with a value that is the same as the id being given to the dialog itself. See code example below to see this in action.

Additionally, both the cancel button and the confirm button have optional id props which can be used to pass in a custom id to allow developers to target that button with custom javascript if needed (confirm_button_id and cancel_button_id).

Complex


The dialog kit also supports customizing your dialog with a compound component structure.
This allows for greater flexibility and more complex dialogs.

For the Rails version, when using the kit as a compound component it is necessary to pass the same value as the id for the dialog, the dialog header and the dialog footer in order for the opening and closing of the dialog to function as expected.

If you are using the datepicker within the Rails dialog, do not use the static_position prop on the datepicker.

Sizes


Scrollable


The dialog will create a scroll container automatically when the text exceeds the height of the page. No prop or configuration is needed.

When such a scroll container is created, the dialog header will remain fixed at top of dialog and not scroll with the body content.

If the dialog is a fullHeight variant, the header and footer will both be sticky and not scroll with the body content.

Overlay Click


When shouldCloseOnOverlayClick is explicitly set to false, click events on the overlay will not close the modal.
By default, shouldCloseOnOverlayClick is set to true.

Status Alert


The Dialog kit also offers customizable Status Alert options as seen here.

For the rails version of the kit, when using custom confirm and cancel buttons as shown in these examples, the 'cancel' button must be given a close-dialog data attribute with a value that is the same as the id given to the dialog itself.

Stacked Button Alert


These examples highlight how the buttons within the Dialog can be stacked when using the Status Alert variant. It also has a link style for the buttons for the mobile views.

Full Height


To render a full height Dialog, use the fullHeight (react) or full_height (rails) prop. A full height Dialog can be size small, medium, or large. By default it will be center aligned.

Full Height Placement


The full height dialog is centered by default, but the placement can be changed via the placement prop with one of the following values: left, center, right.

The large variant however will always be centered, even if the placement prop is used.

All dialogs with the fullHeight prop will be displayed full-width on mobile screens.

Loading


Pressing the "Okay" button will trigger a loading state where the button content is replaced by a spinner icon and both buttons are disabled.

Overflow Visible


Use the overflow="visible" global prop to allow Date Picker and Typeahead dropdown menus to appear outside the dialog boundaries. By default, dialogs clip content that extends beyond their edges, but this prop enables pop-up elements to render above the dialog overlay.

Close Button in Header


The closeable prop can be set to false to optionally render the Dialog header without the close “X” button. closeable is set to true by default.

This prop can be used with the simple as well as the complex version of the Dialog as can be seen here.

Fixed Confirmation Toast

Default


Nav Margin Top


Use the navMarginTop prop to position the toast lower on the page. This is useful for cases where we want to position the toast below a header or nav.

Multi Line


Multi-line is used when the given text will not fit on one line. Using Multi Line allows the height of the confirmation toast to grow. Simply resize the screen to see the fixed confirmation toast wrap the text.

Click to Close


Click to Show Positions


Click to Show Auto Close


Auto close is used when you want the confirmation toast to close automatically after a certain time. autoClose property will be a delay number in ms.

Children


Pass anything (including any of our kits) to the children prop to customize the content of the fixed confirmation toast.

NOTE: passing children overrides any content passed to text

Custom Icon


No Icon


Setting icon prop to "none" will render the fixed confirmation toast without the left side icon.

Popover

Default


Dropdown example


Notice offset is not set so the popover is flush with the content.

Close Options


Set Z-Index


Scroll and Height Settings


With Actionable Content


Append To


By default, the popover tooltip attaches to the <body>. To attach it elsewhere, use the appendTo prop. Set it to "parent" to place the tooltip inside its parent element, or pass any CSS selector (#id or .class) to specify a custom container.

Placement


Use the placement prop to control where the popover appears relative to its trigger. Valid values include top, bottom, left, right, and aligned variants such as top-start, top-end, bottom-start, bottom-end, left-start, left-end, right-start, and right-end.

Tooltip

Default


You can define the tooltip placement sending the prop placement with one of the available options: top | right | bottom | left.

If you don't specify a desired placement, the component will automatically choose the one that fits better.

If the desired placement doesn't fit on screen, the component will automatically switch to the one that fits better.

Content Interaction


Set the prop interaction as true for cases that require users to copy the content inside the tooltip.

Margin


You should set margin in the tooltip component itself. If you add this prop to the child, it will cause the tooltip to be pulled away from the trigger.

It is not recommended to set padding in the tooltip nor its child, doing so will cause it to be pulled away from its trigger element.

Tooltip Sizing


You can customize the height and width of the tooltip's popover.

When using maxHeight, be sure to set a width as well. The text needs to truncate within the width prop.

Tooltip with Icon


Set the prop icon with the desired icon to display inside the tooltip.

Delay


Waits for the specified time when the event listener runs before triggering the tooltip.

The delay accepts number in ms or an object with open and close properties.

The default is 0.

Show Tooltip


You can build your own logic to control whether to show the tooltip using the showTooltip prop. Its default value is true.

Click on the Toggle state button to change the state of the component and hover over the 'hover me' text to see it in action.

Click to Open


Set the prop useClickToOpen so that the tooltip will only appear when an item is clicked rather than hovered over.