module.exports = { id: 'modal-dialogs', title: 'Modal dialogs', keywords: [`modal`, `dialog`, `contextual`, `alert`, `notification`], description: `
mini.css provides you with a modal dialog component to display messages to users. It is composed of three components - the modal dialog, the toggle button and the close button:
.modal
), immediately followed by a <div>
container. The former serves as your modal dialog's control, while the latter is the actual modal dialog container.This is a modal dialog!
<label for="modal-control">Show modal</label> <input type="checkbox" id="modal-control" class="modal"> <div> <div class="card"> <label for="modal-control" class="modal-close" ></label> <h3 class="section">Modal</h3> <p class="section">This is a modal dialog!</p> </div> </div>`], notes: [ `Modal dialogs should be used in combination with the card component for best results.`, `Remember to apply the appropriate classes to any and all elements, as indicated in the examples. Failing to do so will result in the modal dialog not rendering or behaving properly.`, `You can omit the toggle for the modal dialog and use Javascript to show/hide it, instead. You can also use any correctly linked label inside the modal dialog to change its state.` ], customization: [ `Background color for the modal dialog overlay can be changed by changing the value of
--modal-overlay-color
.`,
`Text color for the modal dialog close button can be changed by changing the value of the --modal-close-color
.`,
`Background color for the modal dialog close button when focused or hovered over can be changed by changing the value of the --modal-close-hover-color
.`,
`Universal margin for elements can be changed globally by changing the value of the --universal-margin
variable. As a rule of thumb, consider the universal margin to be the distance you want your paragraphs to have from the sides of the screen.`,
`Universal padding for elements can be changed globally by changing the value of the --universal-padding
variable.`,
`Universal border radius for elements can be changed globally by changing the value of the --universal-border-radius
variable.`
],
modifiers: [],
dos: [
{
description: `You can use the role="dialog"
to add accessibility to your modal dialogs. Remember to properly label it and manage keyboard focus, as required.`,
sample: `<input type="checkbox" id="modal-control" class="modal"> <div role="dialog" aria-labelledby="dialog-title"> <div class="card"> <label for="modal-control" class="modal-close" ></label> <h3 class="section" id="dialog-title">Modal</h3> <p class="section">This is a modal dialog!</p> </div> </div>` } ], donts: [ { description: `You should not place anything between the checkbox controlling the modal dialog and the container.`, sample: `
<input type="checkbox" id="modal-control" class="modal"> <!-- Do not place other stuff between these --> <div> <div class="card"> <label for="modal-control" class="modal-close" ></label> <h3 class="section">Modal</h3> <p class="section">This is a modal dialog!</p> </div> </div>` } ] }