2022-02-01 19:48:57 +00:00
|
|
|
# adopt-styles
|
|
|
|
|
|
|
|
Adopt/apply given styles to a `ShadowRoot` using constructable styleSheets if supported
|
|
|
|
|
|
|
|
```hbs preview-template
|
|
|
|
<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
|
|
|
|
|
|
|
|
| Argument | Type | Default | Description |
|
|
|
|
| --- | --- | --- | --- |
|
2022-03-07 09:51:47 +00:00
|
|
|
| `params` | `[ShadowRoot, (CSSResultGroup \| CSSResultGroup[])]` | | |
|
2022-02-01 19:48:57 +00:00
|
|
|
|