Open genki opened 5 days ago
Visit the deploys page to approve it
Name | Link |
---|---|
Latest commit | 44d716d556cdebc255740f5264c79b136effdadc |
Run & review this pull request in StackBlitz Codeflow.
commit: 44d716d
``` npm i https://pkg.pr.new/@builder.io/qwik@6614 ```
``` npm i https://pkg.pr.new/@builder.io/qwik-city@6614 ```
``` npm i https://pkg.pr.new/eslint-plugin-qwik@6614 ```
``` npm i https://pkg.pr.new/create-qwik@6614 ```
- [default](https://pkg.pr.new/template/e81239c0-5a42-478f-ac4f-294154ec8b63)
Thanks @genki we used to have a team discussion for new APIs so I marked this PR with the correct label. 😊
@gioboa Thanks :)
Overview
What is it?
Description
The
useStyles$
can style entire page but it couldn't scope to components. TheuseStylesScoped$
can style scoped to the component but it couldn't style its child components. So I added one more thing, theuseStyleWithScope$
that introduces the:scope
pseudo class to scope styles manually.By using this function, you can use
:scope
pseudo class to be replaced with.${scopeId}
.The above css is to be like this:
Use cases and why
While the
useStylesScoped$
put the scopeId to every rules in the CSS, this function can select rules to put it. So you can scope styles to the component and its children such as<Link>
components too.Checklist: