The Box

The Box is primarily for styling purposes. It's to add styles that aren't inherited from parents.

Values that should be controlled by a Box:

Two ways to make something look like a Box:

  1. border
  2. background

If you change the background color and need to change the font color, you can set .box * to color: inherit, reducing the number of places where you have to override the colors.

Inverted Colors

If you're using CSS variables, you can make a .box.invert rule that sets color and background-color to their opposite values.

Example

This is a normal paragraph with a white background.

This is a paragraph with colors inverted by a CSS filter rule.

Inverting doesn't work as well when there are colors, as shown by the image examples below.

Mountain sunset Mountain sunset

It's getting really detailed with high-contrast system themes on Windows, where the background colors might be removed. You can create a transparent outline that will only show for those visitors. (The example above has that transparent outline applied to it.)

The Component

Their web component example has the following props: