Reboot·续
These changes, and more, are demonstrated below.
<fieldset> <legend>Example legend</legend> <p> <label for="input">Example input</label> <input type="text" id="input" placeholder="Example input"/> </p> <p> <label for="email">Example email</label> <input type="email" id="email" placeholder="test@example.com"/> </p> <p> <label for="tel">Example telephone</label> <input type="tel" id="tel"/> </p> <p> <label for="url">Example url</label> <input type="url" id="url"/> </p> <p> <label for="number">Example number</label> <input type="number" id="number"/> </p> <p> <label for="search">Example search</label> <input type="search" id="search"/> </p> <p> <label for="range">Example range</label> <input type="range" id="range" min="0" max="10"/> </p> <p> <label for="file">Example file input</label> <input type="file" id="file"/> </p> <p> <label for="select">Example select</label> <select id="select"> <option value="">Choose...</option> <optgroup label="Option group 1"> <option value="">Option 1</option> <option value="">Option 2</option> <option value="">Option 3</option> </optgroup> <optgroup label="Option group 2"> <option value="">Option 4</option> <option value="">Option 5</option> <option value="">Option 6</option> </optgroup> </select> </p> <p> <label> <input type="checkbox" value=""/> Check this checkbox </label> </p> <p> <label> <input type="radio" name="optionsRadios" id="optionsRadios1" value="option1" checked/> Option one is this and that </label> <label> <input type="radio" name="optionsRadios" id="optionsRadios2" value="option2"/> Option two is something else that’s also super long to demonstrate the wrapping of these fancy form controls. </label> <label> <input type="radio" name="optionsRadios" id="optionsRadios3" value="option3" disabled/> Option three is disabled </label> </p> <p> <label for="textarea">Example textarea</label> <textarea id="textarea" rows="3"></textarea> </p> <p> <label for="date">Example date</label> <input type="date" id="date"/> </p> <p> <label for="time">Example time</label> <input type="time" id="time"/> </p> <p> <label for="password">Example password</label> <input type="password" id="password"/> </p> <p> <label for="datetime-local">Example datetime-local</label> <input type="datetime-local" id="datetime-local"/> </p> <p> <label for="week">Example week</label> <input type="week" id="week"/> </p> <p> <label for="month">Example month</label> <input type="month" id="month"/> </p> <p> <label for="color">Example color</label> <input type="color" id="color"/> </p> <p> <label for="output">Example output</label> <output name="result" id="output">100</output> </p> <p> <button type="submit">Button submit</button> <input type="submit" value="Input submit button"/> <input type="reset" value="Input reset button"/> <input type="button" value="Input button"/> </p> <p> <button type="submit" disabled>Button submit</button> <input type="submit" value="Input submit button" disabled/> <input type="reset" value="Input reset button" disabled/> <input type="button" value="Input button" disabled/> </p> </fieldset> </form>`} />
Pointers on buttons
Reboot includes an enhancement for role="button" to change the default cursor to pointer. Add this attribute to elements to help indicate elements are interactive. This role isn’t necessary for <button> elements, which get their own cursor change.
<Example code={<span role="button" tabindex="0">Non-button element button</span>} />
Misc elements
Address
The <address> element is updated to reset the browser default font-style from italic to normal. line-height is also now inherited, and margin-bottom: 1rem has been added. <address>s are for presenting contact information for the nearest ancestor (or an entire body of work). Preserve formatting by ending lines with <br>.
<strong>ACME Corporation</strong><br/> 1123 Fictional St,<br/> San Francisco, CA 94103<br/> <abbr title="Phone">P:</abbr> (123) 456-7890 </address>
<address> <strong>Full Name</strong><br/> <a href="mailto:first.last@example.com">first.last@example.com</a> </address>`} />
Blockquote
The default margin on blockquotes is 1em 40px, so we reset that to 0 0 1rem for something more consistent with other elements.
<blockquote class="blockquote"> <p>A well-known quote, contained in a blockquote element.</p> </blockquote> <figcaption> Someone famous in <cite title="Source Title">Source Title</cite> </figcaption> </figure>`} />
Inline elements
The <abbr> element receives basic styling to make it stand out amongst paragraph text.
<Example showMarkup={false} code={The <abbr title="HyperText Markup Language">HTML</abbr> abbreviation element.} />
Summary
The default cursor on summary is text, so we reset that to pointer to convey that the element can be interacted with by clicking on it.
<Example showMarkup={false} code={` <details> <summary>Some details</summary> <p>More info about the details.</p> </details>
<details open> <summary>Even more details</summary> <p>Here are even more details about the details.</p> </details> `} />
HTML5 [hidden] attribute
HTML5 adds a new global attribute named [hidden], which is styled as display: none by default. Borrowing an idea from PureCSS, we improve upon this default by making [hidden] { display: none !important; } to help prevent its display from getting accidentally overridden.
<input type="text" hidden>
Since [hidden] is not compatible with jQuery’s $(...).hide() and $(...).show() methods, we don’t specifically endorse [hidden] over other techniques for managing the display of elements.
To merely toggle the visibility of an element, meaning its display is not modified and the element can still affect the flow of the document, use the .invisible class instead.
iframe color-scheme
The <iframe> element is updated to set color-scheme: light dark. A browser paints an opaque background: canvas behind an iframe when the embedded document uses a different color scheme than the iframe element. On a dark page that shows as a white box.
An embedded document follows the system preference. It cannot see your data-bs-theme attribute. We therefore pin every iframe to the system preference too. This keeps an embed transparent, also when you force a theme with data-bs-theme.
<iframe class="w-100" style="color-scheme: unset" src="data:text/html,<!DOCTYPE html><html><meta name='color-scheme' content='light dark'><body style='background-color:transparent;color:gray;'><h4>Default iframe</h4></body></html>"></iframe> <iframe class="w-100" src="data:text/html,<!DOCTYPE html><html><meta name='color-scheme' content='light dark'><body style='background-color:transparent;color:gray;'><h4>iframe with color-scheme: light-dark</h4></body></html>"></iframe> <iframe class="w-100" src="data:text/html,<!DOCTYPE html><html><body style='background-color:transparent;color:gray;'><h4>Embed that declares no color scheme</h4></body></html>"></iframe> </div>`} />
The first two embeds declare <meta name="color-scheme" content="light dark">, so they follow the system preference and stay transparent. The third declares nothing, like most third-party embeds. Set your system to dark mode to see the browser paint a white box behind it. Our rule cannot prevent that — read the next section.
Third-party embeds with no dark mode
Some third-party embeds have no dark mode. Payment buttons, comment widgets, and review widgets are common examples. The browser paints a white background behind such an embed when the system is in dark mode. This is a browser safeguard. It keeps the light content of the embed readable. Bootstrap cannot remove it for you.
Add the .color-scheme-light color scheme utility to that one iframe. The background becomes transparent again.
<iframe class="color-scheme-light" src="..."></iframe>
Use this only for an embed that has no dark mode. Safari and Firefox apply the value to the embedded document. An embed that has a dark mode then shows in light mode.
