Skip to content

[Content]: Guide claims styles are scoped when imported #1282

@PydraxAlpta

Description

@PydraxAlpta

📚 Subject area/topic

/concepts/components/class-style.mdx

📋 Page(s) affected (or suggested, for new content)

https://docs.solidjs.com/concepts/components/class-style

📋 Description of content that is out-of-date or incorrect

The SolidJS Docs claims that

Classes are defined in CSS files, which are then imported into the component files that use them. You can import these files using the import statement at the top of your component file. Once imported into a component, the classes are scoped to that component and any of its children.
import "./Card.css";

However, this is not the case. We can test this by creating a new solidjs project with npm create vite (I tried npm init solid, but I got an ERROR Subdirectory not found error when creating the project.) and then creating two components containing the same class but with different properties.

AFAIK SolidJS does not package a css scoping solution of it's own, and importing css files just does whatever vite does under the hood (which makes the css global) so I don't understand why the docs claim otherwise in the concepts.

🖥️ Reproduction in StackBlitz (if reporting incorrect content or code samples)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsolidRelated to core Solid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions