Back to Consul

adopt-styles

ui/packages/consul-ui/app/helpers/adopt-styles.mdx

1.22.7598 B
Original Source

adopt-styles

Adopt/apply given styles to a ShadowRoot using constructable styleSheets if supported

hbs
<div
  {{attach-shadow (set this 'shadow')}}
>
  {{#if this.shadow}}
    {{#in-element this.shadow}}
      {{adopt-styles this.shadow (css '
        :host {
          background-color: red;
          width: 100px;
          height: 100px;
        }
      ')}}
    {{/in-element}}
  {{/if}}
</div>

Positional Arguments

ArgumentTypeDefaultDescription
params[ShadowRoot, (CSSResultGroup | CSSResultGroup[])]