Native styles use design tokens to spruce up native HTML elements so that they match the look and feel of your theme. While these native styles are completely optional, they're a great starting point for a cohesive design and a huge help when using a combination of native elements and Web Awesome components in your project.
Using native styles
Link to This Section CDN npm Self-Hosted
Head over to your project's Settings.
Next to Features, select the Native styles checkbox.
Save Changes to immediately update anywhere you're using your project.
To use all Web Awesome styles (including utilities), import the following stylesheet in your project:
You can additionally include any pre-made theme or color palette to change the look of native elements.
Opting out of native styles
Link to This Section
If you want to keep Web Awesome's components, tokens, and utilities but let a native element fall back to browser defaults, reset that element in your own stylesheet.
<divclass="wa-cluster wa-align-items-center"><buttontype="button">Styled by native.css</button><buttontype="button"class="native-reset">Browser default button</button></div><style>.native-reset{all: revert;font: inherit;}</style>
Use all: revert on the exact element you want to opt out of native styles. Re-apply any properties you still want to inherit from your app, such as font.
To opt out for an entire section, apply the same reset within a wrapper and target only the native elements in that area.
If your app has separate page-level entry points, the simplest page-level opt-out is to not load native.css on pages that should keep browser defaults. You can still load your theme, components, and any utilities you want on those pages.
Content flow
Link to This Section
Native styles set default space between many block-level HTML elements using the --wa-content-spacing token from your theme. This helps ensure that your content is readable.
Content flows naturally
Native styles set consistent spacing between block-level elements using your theme's design tokens. This means
headings, paragraphs, lists, and other elements look great together without extra effort.
The Road goes ever on and on
Out from the door where it began.
Spacing is controlled by the --wa-content-spacing token, so you can easily adjust it to match your
design. Set it to zero if you prefer to handle spacing yourself.
Aenean imperdiet
Vivamus consectetur at est
Quisque vel leo in leo semper
<h3>Content flows naturally</h3><p>
Native styles set consistent spacing between block-level elements using your theme's design tokens. This means
headings, paragraphs, lists, and other elements look great together without extra effort.
</p><blockquote>
The Road goes ever on and on<br/>
Out from the door where it began.
</blockquote><p>
Spacing is controlled by the <code>--wa-content-spacing</code> token, so you can easily adjust it to match your
design. Set it to zero if you prefer to handle spacing yourself.
</p><hr/><ul><li>Aenean imperdiet</li><li>Vivamus consectetur at est</li><li>Quisque vel leo in leo semper</li></ul>
To remove this default spacing, you can set --wa-content-spacing: 0 in your styles.
Typography
Link to This Section
Native styles use typography design tokens to style text elements. A number of styles — such as color, font-family, font-size, font-weight, and line-height — are set on the <body> element to be inherited by child elements.
Headings
Link to This Section
Create headings with <h1> through <h6>. Headings use tokens with the -heading suffix, condensed line height, and text-wrap: balance for a prominent yet compact appearance.
Create paragraphs with <p>. Paragraphs inherit the default text styles set on the <body> element and use text-wrap: pretty to prevent orphaned lines in supported browsers.
Paragraphs inherit the default text styles set on the body element, including font family, size, weight, and line
height. They also use text-wrap: pretty to prevent orphaned lines in supported browsers.
You can have as many paragraphs as you need and they'll maintain consistent spacing between them. Native styles ensure
everything stays readable and well-proportioned, no matter how much content you throw at it.
<p>
Paragraphs inherit the default text styles set on the body element, including font family, size, weight, and line
height. They also use <code>text-wrap: pretty</code> to prevent orphaned lines in supported browsers.
</p><p>
You can have as many paragraphs as you need and they'll maintain consistent spacing between them. Native styles ensure
everything stays readable and well-proportioned, no matter how much content you throw at it.
</p>
Blockquotes
Link to This Section
Emphasize longer quotations with <blockquote>. Block quotes use your theme's serif font family and a leading border to stand out.
What is a Web year now, about three months? And when people can browse around, discover new things, and download them
fast, when we all have agents - then Web years could slip by before human beings can notice.
— Tim Berners-Lee
<blockquote>
What is a Web year now, about three months? And when people can browse around, discover new things, and download them
fast, when we all have agents - then Web years could slip by before human beings can notice.<br/><br/>
— Tim Berners-Lee
</blockquote>
Lists
Link to This Section
Create ordered and unordered lists with <ol> and <ul>, plus <li> for list items within.
First item
Another item
Nested item
Another nested item
Final item
First item
Another item
Nested item
Another nested item
Final item
<divclass="wa-grid"><ol><li>First item</li><li>
Another item
<ol><li>Nested item</li><li>Another nested item</li></ol></li><li>Final item</li></ol><ul><li>First item</li><li>
Another item
<ul><li>Nested item</li><li>Another nested item</li></ul></li><li>Final item</li></ul></div>
Use <dl> to create lists of terms (<dt>) and definitions (<dd>).
Web Components
A set of web platform APIs that let you create custom, reusable HTML elements. They work across frameworks and
browsers, making them ideal for building design systems and component libraries.
Shadow DOM
A browser feature that lets you attach a hidden DOM tree to an element. This keeps your component's styles and
markup encapsulated, so they won't accidentally interfere with the rest of the page.
Custom Elements
A JavaScript API that lets you define new HTML tags with their own behavior. Once registered, you can use them
anywhere in your markup just like built-in elements.
<dl><dt>Web Components</dt><dd>
A set of web platform APIs that let you create custom, reusable HTML elements. They work across frameworks and
browsers, making them ideal for building design systems and component libraries.
</dd><dt>Shadow DOM</dt><dd>
A browser feature that lets you attach a hidden DOM tree to an element. This keeps your component's styles and
markup encapsulated, so they won't accidentally interfere with the rest of the page.
</dd><dt>Custom Elements</dt><dd>
A JavaScript API that lets you define new HTML tags with their own behavior. Once registered, you can use them
anywhere in your markup just like built-in elements.
</dd></dl>
Code blocks
Link to This Section
Create code blocks or other preformatted text with <pre>. Preformatted text uses your theme's monospace font family and a subtle background color.
// do a thing
export function thing() {
return true;
}
<pre>
// do a thing
export function thing() {
return true;
}
</pre>
Inline text
Link to This Section
Use any inline text element like <strong>, <em>, <a>, <kbd>, and others to stylize or emphasize text.
BoldItalicUnderlineStrike-throughDeleted
Inserted
Small
Subscript SubSuperscript Sup
Abbr.
Highlighted
Link textInline codeKeyboard
Add responsive media with <img>, <svg>, <video>, <iframe>, and others. Media takes up 100% width by default and scales according to its container's width.
<imgsrc="https://images.unsplash.com/photo-1620196244888-d31ff5bbf163?q=80&w=1000&auto=format&fit=crop&ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D"alt="A gray kitten lays next to a toy"/>
Tables
Link to This Section
Structure tabular data with <table> and related elements like <caption>, <thead>, <tbody>, <th>, <tr>, and <td>.
This
<caption>
describes the table
First column
Second column
Third column
Final column
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
Data
<table><caption>
This
<code><caption></code>
describes the table
</caption><thead><tr><th>First column</th><th>Second column</th><th>Third column</th><th>Final column</th></tr></thead><tbody><tr><td>Data</td><td>Data</td><td>Data</td><td>Data</td></tr><tr><td>Data</td><td>Data</td><td>Data</td><td>Data</td></tr><tr><td>Data</td><td>Data</td><td>Data</td><td>Data</td></tr><tr><td>Data</td><td>Data</td><td>Data</td><td>Data</td></tr></tbody></table>
Add the wa-hover-rows class to highlight table rows on hover and the wa-zebra-rows class to add alternating row colors to your table.
Create disclosure widgets with <details> and <summary>. Details closely match the appearance of <wa-details>.
Summary
Click the summary to expand and reveal this content. Native details elements are styled to closely match the
appearance of the <wa-details> component, so they fit right in with the rest of your UI.
<details><summary>Summary</summary><p>
Click the summary to expand and reveal this content. Native details elements are styled to closely match the
appearance of the <code><wa-details></code> component, so they fit right in with the rest of your UI.
</p></details>
Dialog
Link to This Section
Create modal and non-modal dialog boxes with <dialog>. Dialogs closely match the appearance of <wa-dialog>.
<dialogid="dialog-example"><p>This is a native dialog element styled to match Web Awesome components.</p><buttontype="button">Close</button></dialog><button>Open Dialog</button><script>const dialog = document.querySelector('#dialog-example');const openButton = dialog.nextElementSibling;const closeButton = dialog.querySelector('button');
openButton.addEventListener('click',()=> dialog.showModal());
closeButton.addEventListener('click',()=> dialog.close());</script>
Progress
Link to This Section
Create progress indicators with <progress>. Progress indicators closely match the appearance of <wa-progress-bar>.
Native styles use form control design tokens to style form elements like buttons and inputs. Form elements additionally inherit font-family from the <body> element.
Buttons
Link to This Section
Create buttons with <button> or <input type="button | submit | reset">. Buttons closely match the appearance of <wa-button>.
Add the wa-pill class to give buttons rounded edges.
<buttonclass="wa-pill">Pill button</button>
When using <wa-icon> within a button, wrap adjacent label text in <span> or similar to automatically add margin between the icon and the label, just like the start and end slots of <wa-button>.
Create a variety of form controls with <input type="">, <select>, and <textarea>. Each control closely matches the appearance of the corresponding Web Awesome component.
<divclass="wa-stack"><label>Text <inputtype="text"placeholder="add some text"/></label><label>Date <inputtype="date"/></label><label>Time <inputtype="time"/></label><label>Number <inputtype="number"placeholder="12345"/></label><label>Color <inputtype="color"value="#f36944"/></label><label>File <inputtype="file"multiple/></label><label>Range <inputtype="range"/></label><label>Select
<select><optionvalue="option-1">Option 1</option><optionvalue="option-2">Option 2</option><optionvalue="option-3">Option 3</option></select></label><label>Textarea <textareaplaceholder="add more text"></textarea></label><divclass="wa-cluster"><label><inputtype="checkbox"checked/> Checked</label><label><inputtype="checkbox"class="indeterminate"/> Indeterminate</label><label><inputtype="checkbox"/> Unchecked</label></div><divclass="wa-cluster"><label><inputtype="radio"name="radio-group"value="1"checked/> First radio</label><label><inputtype="radio"name="radio-group"value="2"/> Second radio</label><label><inputtype="radio"name="radio-group"value="3"/> Third radio</label></div></div><script>
document.querySelector('.indeterminate').indeterminate =true;</script>
Add a wa-size-* class to any form control or its parent <label> to specify its size. Available sizes are wa-size-xs, wa-size-s, wa-size-m, wa-size-l, and wa-size-xl.
<divclass="wa-stack"><inputtype="text"placeholder="Extra small input"class="wa-size-xs"/><divclass="wa-cluster"><labelclass="wa-size-xs"><inputtype="checkbox"checked/> Extra small checkbox</label><labelclass="wa-size-xs"><inputtype="radio"name="radio-xs"value="1"checked/> Extra small radio</label></div><inputtype="text"placeholder="Small input"class="wa-size-s"/><divclass="wa-cluster"><labelclass="wa-size-s"><inputtype="checkbox"checked/> Small checkbox</label><labelclass="wa-size-s"><inputtype="radio"name="radio-small"value="1"checked/> Small radio</label></div><inputtype="text"placeholder="Medium input"class="wa-size-m"/><divclass="wa-cluster"><labelclass="wa-size-m"><inputtype="checkbox"checked/> Medium checkbox</label><labelclass="wa-size-m"><inputtype="radio"name="radio-medium"value="1"checked/> Medium radio</label></div><inputtype="text"placeholder="Large input"class="wa-size-l"/><divclass="wa-cluster"><labelclass="wa-size-l"><inputtype="checkbox"checked/> Large checkbox</label><labelclass="wa-size-l"><inputtype="radio"name="radio-large"value="1"checked/> Large radio</label></div><inputtype="text"placeholder="Extra large input"class="wa-size-xl"/><divclass="wa-cluster"><labelclass="wa-size-xl"><inputtype="checkbox"checked/> Extra large checkbox</label><labelclass="wa-size-xl"><inputtype="radio"name="radio-xl"value="1"checked/> Extra large radio</label></div></div>
Add the wa-filled class to an input to give it a filled background.
Group form controls together with <fieldset> and <legend>.
<fieldsetclass="wa-stack wa-align-items-start"><legend>Legend</legend><label><inputtype="radio"name="legends"value="1"checked/> King Arthur</label><label><inputtype="radio"name="legends"value="2"/> Robin Hood</label><label><inputtype="radio"name="legends"value="3"/> Odysseus</label></fieldset>
Form layouts
Link to This Section
Wrap form controls in a flex container to arrange them horizontally or vertically with even spacing. Layout utility classes like wa-cluster and wa-stack can be added directly to a <fieldset> or <form> to make this especially easy.
<fieldsetclass="wa-cluster"><legend>Ducks in a row</legend><label><inputtype="checkbox"checked/> Mallard</label><label><inputtype="checkbox"/> Common Loon</label><label><inputtype="checkbox"/> Least Grebe</label></fieldset><br/><formclass="wa-stack"><label>Number of pancakes <inputtype="number"value="5"/></label><label>Syrup flavor
<select><optionvalue="maple">Maple</option><optionvalue="strawberry">Strawberry</option><optionvalue="blueberry">Blueberry</option><optionvalue="pecan">Butter pecan</option></select></label><label><inputtype="checkbox"checked/> Add whipped butter</label><button><wa-iconname="layer-group"></wa-icon>
Stack 'em up
</button></form>