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
).
<%= pb_rails("button", props: { text: "Open Dialog", data: {"open-dialog": "dialog-1"} }) %> <%= pb_rails("dialog", props: { id:"dialog-1", size: "sm", title: "Header Title is the Title Prop", text: "Hello Body Text, Nice to meet ya.", cancel_button: "Cancel Button", confirm_button: "Okay", confirm_button_id: "confirm-button-1" }) %>
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.
<%= pb_rails("button", props: { text: "Open Complex Dialog", data:{"open-dialog": "dialog-complex"} }) %> <%= pb_rails("dialog", props: { id:"dialog-complex", size: "lg", full_height: true }) do %> <form> <%= pb_rails("dialog/dialog_header", props: { id: "dialog-complex" } ) do %> <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %> <% end %> <%= pb_rails("dialog/dialog_body") do %> <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %> <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %> <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %> <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %> <% end %> <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-complex"}) %> </form> <% end %>
<%= pb_rails("button", props: { text: "Small Dialog", data:{"open-dialog": "dialog-sm"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Medium Dialog", data:{"open-dialog": "dialog-md"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Large Dialog", data:{"open-dialog": "dialog-lg"}, margin_right: "md" }) %> <%= pb_rails("dialog", props: { id:"dialog-sm", size: "sm", title: "Header on small dialog", text: "Body on small dialog", cancel_button: "Cancel", confirm_button: "Okay", }) %> <%= pb_rails("dialog", props: { id:"dialog-md", size: "md", title: "Title on medium dialog", text: "Body on medium dialog", cancel_button: "Cancel", confirm_button: "Okay", }) %> <%= pb_rails("dialog", props: { id:"dialog-lg", size: "lg", title: "Header on large dialog", text: "Body on large dialog", cancel_button: "Cancel", confirm_button: "Okay" }) %>
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.
<%= pb_rails("button", props: { text: "Open Dialog", data: {"open-dialog": "dialog-scroll"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Open Full Height Dialog", data: {"open-dialog": "dialog-scroll-full-height"}, margin_right: "md" }) %> <%= pb_rails("dialog", props: { id:"dialog-scroll", size: "md", title: "Header Title is the Title Prop", text: "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.", cancel_button: "Cancel", confirm_button: "Confirm", confirm_button_id: "confirm-button-1" }) %> <%= pb_rails("dialog", props: { full_height: true, id:"dialog-scroll-full-height", size: "sm", title: "Header Title is the Title Prop", text: "At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Temporibus autem quibusdam et aut officiis debitis aut rerum necessitatibus saepe eveniet ut et voluptates repudiandae sint et molestiae non recusandae. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat. At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident.", cancel_button: "Cancel", confirm_button: "Confirm", confirm_button_id: "confirm-button-1" }) %>
When shouldCloseOnOverlayClick
is explicitly set to false
, click events on the overlay will not close the modal.
By default, shouldCloseOnOverlayClick
is set to true.
<%= pb_rails("button", props: { text: "Open Dialog", data: {"open-dialog": "dialog-overlay-click"} }) %> <%= pb_rails("dialog", props: { id:"dialog-overlay-click", size: "sm", title: "Neat Header", text: "Click on the overlay all day. I will stay open.", cancel_button: "Cancel", confirm_button: "Okay", confirm_button_id: "confirm-button-1", should_close_on_overlay_click: false, }) %>
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.
<%= pb_rails("flex", props:{ gap: "xs", wrap:true}) do %> <%= pb_rails("button", props: { text: "Default Status", data: {"open-dialog": "dialog-status-default"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Caution Status", data: {"open-dialog": "dialog-status-caution"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Delete Status", data: {"open-dialog": "dialog-status-delete"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Information Status", data: {"open-dialog": "dialog-status-info"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Error Status", data: {"open-dialog": "dialog-status-error"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Success Status", data: {"open-dialog": "dialog-status-success"}, margin_right: "md" }) %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-status-default", status: "default", size: "status_size", title: "Are you sure?", text: "Text explaining why there is an alert", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { spacing:"between", padding_x:"md", padding_bottom:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Yes, Action" }) %> <%= pb_rails("button", props: { text: "No, Cancel", variant: "secondary", data: {"close-dialog": "dialog-status-default" } }) %> <% end %> <% end %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-status-info", status: "info", size: "status_size", title: "Information", text: "Text explaining why there is an alert", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { spacing:"between", padding_x:"md", padding_bottom:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Ok, Thanks!", full_width: true, data: {"close-dialog": "dialog-status-info" } }) %> <% end %> <% end %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-status-caution", status: "caution", size: "status_size", title: "Are you Sure?", text: "This is the action you will be taking", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { spacing:"between", padding_x:"md", padding_bottom:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Yes, Action" }) %> <%= pb_rails("button", props: { text: "No, Cancel", variant: "secondary", data: {"close-dialog": "dialog-status-caution" } }) %> <% end %> <% end %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-status-delete", status: "delete", size: "status_size", title: "Delete", text: "You are about to delete ...", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { spacing:"between", padding_x:"md", padding_bottom:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Yes, Delete" }) %> <%= pb_rails("button", props: { text: "No, Cancel", variant: "secondary", data: {"close-dialog": "dialog-status-delete" } }) %> <% end %> <% end %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-status-error", status: "error", size: "status_size", title: "Error Message", text: "Text explaining the error", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { spacing:"between", padding_x:"md", padding_bottom:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Oh no!", full_width: true, data: {"close-dialog": "dialog-status-error" } }) %> <% end %> <% end %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-status-success", status: "success", size: "status_size", title: "Success!", text: "Text explaining what is successful", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { spacing:"between", padding_x:"md", padding_bottom:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Great!", full_width: true, data: {"close-dialog": "dialog-status-success" } }) %> <% end %> <% end %> <% end %>
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.
<%= pb_rails("button", props: { text: "Default Status", data: {"open-dialog": "dialog-stacked-default"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Caution Status", data: {"open-dialog": "dialog-stacked-caution"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Delete Status", data: {"open-dialog": "dialog-stacked-delete"}, margin_right: "md" }) %> <%= pb_rails("dialog", props: { id:"dialog-stacked-default", status: "default", size: "sm", title: "Are you sure?", text: "Text explaining why there is an alert", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { orientation: "column", padding_x:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Yes, Action", full_width: true }) %> <%= pb_rails("button", props: { text: "No, Cancel", variant: "secondary", full_width: true, margin_top: "sm", data: {"close-dialog": "dialog-stacked-default" } }) %> <% end %> <% end %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-stacked-caution", status: "caution", size: "sm", title: "Are you sure?", text: "This is the action you will be taking", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { orientation: "column", padding_x:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Yes, Action", full_width: true }) %> <%= pb_rails("button", props: { text: "No, Cancel", variant: "secondary", full_width: true, margin_top: "sm", data: {"close-dialog": "dialog-stacked-caution" } }) %> <% end %> <% end %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-stacked-delete", status: "delete", size: "sm", title: "Delete", text: "You are about to delete ...", }) do %> <%= pb_rails("dialog/dialog_footer") do %> <%= pb_rails("flex", props: { orientation: "column", padding_x:"md", padding: "sm" }) do %> <%= pb_rails("button", props: { text: "Yes, Action", full_width: true }) %> <%= pb_rails("button", props: { text: "No, Cancel", variant: "secondary", full_width: true, margin_top: "sm", data: {"close-dialog": "dialog-stacked-delete" } }) %> <% end %> <% end %> <% end %>
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.
<%= pb_rails("button", props: { text: "Small Dialog", data:{"open-dialog": "dialog-fullheight-sm"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Medium Dialog", data:{"open-dialog": "dialog-fullheight-md"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Large Dialog", data:{"open-dialog": "dialog-fullheight-lg"}, margin_right: "md" }) %> <%= pb_rails("dialog", props: { id:"dialog-fullheight-sm", size: "sm", full_height: true, }) do %> <%= pb_rails("dialog/dialog_header", props: { id: "dialog-fullheight-sm" } ) do %> <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %> <% end %> <%= pb_rails("dialog/dialog_body") do %> <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %> <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %> <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %> <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %> <% end %> <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-fullheight-sm"}) %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-fullheight-md", size: "md", full_height: true, }) do %> <%= pb_rails("dialog/dialog_header", props: { id: "dialog-fullheight-md" } ) do %> <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %> <% end %> <%= pb_rails("dialog/dialog_body") do %> <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %> <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %> <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %> <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %> <% end %> <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-fullheight-md"}) %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-fullheight-lg", size: "lg", full_height: true, }) do %> <%= pb_rails("dialog/dialog_header", props: { id: "dialog-fullheight-lg" } ) do %> <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %> <% end %> <%= pb_rails("dialog/dialog_body") do %> <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %> <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %> <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %> <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %> <% end %> <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-fullheight-lg"}) %> <% end %>
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.
<%= pb_rails("button", props: { text: "Left Dialog", data:{"open-dialog": "dialog-fullheight-left"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Center Dialog", data:{"open-dialog": "dialog-fullheight-center"}, margin_right: "md" }) %> <%= pb_rails("button", props: { text: "Right Dialog", data:{"open-dialog": "dialog-fullheight-right"}, margin_right: "md" }) %> <%= pb_rails("dialog", props: { id:"dialog-fullheight-left", size: "md", full_height: true, placement: "left", }) do %> <%= pb_rails("dialog/dialog_header", props: { id: "dialog-fullheight-left" } ) do %> <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %> <% end %> <%= pb_rails("dialog/dialog_body") do %> <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %> <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %> <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %> <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %> <% end %> <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-fullheight-left"}) %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-fullheight-center", size: "md", full_height: true, placement: "center", }) do %> <%= pb_rails("dialog/dialog_header", props: { id: "dialog-fullheight-center" } ) do %> <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %> <% end %> <%= pb_rails("dialog/dialog_body") do %> <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %> <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %> <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %> <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %> <% end %> <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-fullheight-center"}) %> <% end %> <%= pb_rails("dialog", props: { id:"dialog-fullheight-right", size: "md", full_height: true, placement: "right", }) do %> <%= pb_rails("dialog/dialog_header", props: { id: "dialog-fullheight-right" } ) do %> <%= pb_rails("body", props: { text: "What do you need us to take care of?" }) %> <% end %> <%= pb_rails("dialog/dialog_body") do %> <%= pb_rails("caption", props: { text: "Description", margin_bottom: "xs" }) %> <%= pb_rails("rich_text_editor", props: {id: "default", value: "Add your text here"}) %> <%= pb_rails("caption", props: { text: "Type in a word or term too help find tickets later. ex. training, phone setup, hr", margin_bottom: "xs", margin_top: "sm" }) %> <%= pb_rails("typeahead", props: { placeholder: "Tags.."}) %> <% end %> <%= pb_rails("dialog/dialog_footer", props: {cancel_button: "Back", confirm_button: "Send my Issue", confirm_button_id:"confirm-complex", id: "dialog-fullheight-right"}) %> <% end %>
Pressing the "Okay" button will trigger a loading state where the button content is replaced by a spinner icon and both buttons are disabled.
<%= pb_rails("button", props: { text: "Open Dialog", data: {"open-dialog": "dialog-loading"} }) %> <%= pb_rails("dialog", props: { id:"dialog-loading", size: "sm", title: "Loading Example", text: "Make a loading request?", cancel_button: "Cancel Button", cancel_button_id: "cancel-button-loading", confirm_button: "Okay", confirm_button_id: "confirm-button-loading", loading: true, }) %> <script> const loadingButton = document.querySelector('[data-disable-with="Loading"]'); if (loadingButton) { loadingButton.addEventListener("click", function() { const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]'); const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]'); let currentClass = okayLoadingButton.className; let cancelClass = cancelButton ? cancelButton.className : ""; setTimeout(function() { okayLoadingButton.disabled = false; okayLoadingButton.className = currentClass.replace("_disabled_loading", "_enabled"); if (cancelButton) { cancelButton.disabled = false; cancelButton.className = cancelClass.replace("_disabled", "_enabled"); } }, 5000); }); } </script>
Props | Type | Values |
---|---|---|
max_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
min_width |
array
|
0%
xs
sm
md
lg
xl
xxl
0
none
100%
|
z_index |
array
|
1
2
3
4
5
6
7
8
9
10
|
number_spacing |
array
|
tabular
|
shadow |
array
|
none
deep
deeper
deepest
|
line_height |
array
|
tightest
tighter
tight
normal
loose
looser
loosest
|
display |
array
|
block
inline_block
inline
flex
inline_flex
none
|
cursor |
array
|
auto
default
none
contextMenu
help
pointer
progress
wait
cell
crosshair
text
verticalText
alias
copy
move
noDrop
notAllowed
grab
grabbing
eResize
nResize
neResize
nwResize
sResize
seResize
swResize
wResize
ewResize
nsResize
neswResize
nwseResize
colResize
rowResize
allScroll
zoomIn
zoomOut
|
flex_direction |
array
|
row
column
rowReverse
columnReverse
|
flex_wrap |
array
|
wrap
nowrap
wrapReverse
|
justify_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
justify_self |
array
|
auto
start
end
center
stretch
|
align_items |
array
|
flexStart
flexEnd
start
end
center
baseline
stretch
|
align_content |
array
|
start
end
center
spaceBetween
spaceAround
spaceEvenly
|
align_self |
array
|
auto
start
end
center
stretch
baseline
|
flex |
array
|
auto
initial
0
1
2
3
4
5
6
7
8
9
10
11
12
none
|
flex_grow |
array
|
1
0
|
flex_shrink |
array
|
1
0
|
order |
array
|
1
2
3
4
5
6
7
8
9
10
11
12
|
position |
array
|
relative
absolute
fixed
sticky
|
hover |
array
|
|
border_radius |
array
|
none
xs
sm
md
lg
xl
rounded
|
text_align |
array
|
start
end
left
right
center
justify
justify-all
match-parent
|
overflow |
array
|
visible
hidden
scroll
auto
|
truncate |
array
|
1
2
3
4
5
|
left |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
top |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
right |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
bottom |
array
|
0
xxs
xs
sm
md
lg
xl
auto
initial
inherit
|
vertical_align |
array
|
baseline
super
top
middle
bottom
sub
text-top
text-bottom
|
overflow_x |
array
|
visible
hidden
scroll
auto
|
overflow_y |
array
|
visible
hidden
scroll
auto
|
margin |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
margin_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_bottom |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_left |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_right |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_top |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_x |
array
|
none
xxs
xs
sm
md
lg
xl
|
padding_y |
array
|
none
xxs
xs
sm
md
lg
xl
|
classname |
string
|
|
dark |
boolean
|
|
group_hover |
boolean
|
|
id |
string
|
|
data |
hashprop
|
|
aria |
hashprop
|
|
html_options |
hashprop
|
|
children |
proc
|
|
style |
hashprop
|
|
height |
string
|
|
min_height |
string
|
|
max_height |
string
|
Props | Type | Values | Default |
---|---|---|---|
size |
enum
|
sm
md
lg
xl
status_size
content
|
md
|
full_height |
boolean
|
false
|
|
placement |
enum
|
left
right
center
|
center
|
should_close_on_overlay_click |
boolean
|
true
|
|
title |
string
|
||
text |
string
|
||
loading |
string
|
||
confirm_button |
string
|
||
confirm_button_id |
string
|
||
cancel_button |
string
|
||
cancel_button_id |
string
|
||
status |
enum
|
info
caution
delete
error
success
default
|