Concorde documentation (crawl) · interactive version

Concorde guide — Adding styles. No style crosses the shadow root of a component, except for inheritable properties (which have the "inherit" property possible) and CSS variables. Doc ID: docs/_getting-started/theming. Keywords: Concorde, supersoniks, docs/_getting-started/theming, theming, Adding styles, guide, , size, {reflect: true}, :host(), :host([type='primary']){...}, inline, block, display, contents. URL: https://concorde.supersoniks.org/crawl/docs/_getting-started/theming.html.

Adding styles

Normal Behavior

No style crosses the shadow root of a component, except for inheritable properties (which have the "inherit" property possible) and CSS variables. Properties integrated via a "slot" remain stylizable in a conventional way.

Choosing Style Presets via Reactive Properties:

The declaration of reactive properties is useful for selecting a particular configuration that mostly affects a set of properties.

For example, a size property (xs, sm, md, xl) will affect margins, font, line heights to align them with the corresponding CSS vars, which can be customized using the methods mentioned earlier if necessary.

It is recommended to use the {reflect: true} property for reactive properties that have an associated style on the :host(). For example: :host([type='primary']){...}

☢️ Caution: Passing class names via reactive properties / HTML attributes of the component should be avoided as it can quickly lead to difficult-to-manage situations.

CSS "display" Property

By default, the display property is inline. Therefore, be careful to define it according to the needs, as one might mistakenly expect it to be block as with a regular <div>.

☢️ Caution: Defining the display property as contents may seem attractive at first, but:

TAILWIND Functional Classes

tailwind has been integrated into Concorde and is available in scoped components (with Shadow DOM). To use it, you need to import the following:

import { tailwind } from "@supersoniks/concorde/la-billetterie/ui/theme/theme";

Then include the tailwind style in the static styles property of the component:

static styles = [tailwind];

Finally, use it in the HTML within the render function:

<p class="m-2">A paragraph with margin</p>

The colors from Concorde's theme are referenced in Tailwind's theme.

Operation without Shadow DOM

Usefulness

This operation is particularly useful when it comes to adding behavior to a simple existing element. It may also become necessary to establish compatibility with a traditional JS library.

For example, with a text input:

Consequences

If there is no shadow DOM (see the noShadowDom property of Subscriber):

For example, the components queue, list, and fetch do not have a shadow DOM.

ℹ️ Note: Specifically in this case, it may be useful to set the display property to contents.