Skip to content

Allow inheriting class #15

@nparashar150

Description

@nparashar150

Describe the issue
Elements do not have the option to inherit classes from their sibling element above. Users should be able to specify when a element should inherit the class (e.g., using ["~ text-red-500"] to inherit and override only the specified classes).

To Reproduce
Steps to reproduce the behavior:

  1. Apply a class to element, such as:
    ["text-xs font-bold text-muted-foreground"] This is class applied to paragraph
  2. In another line add class to new element with the "~" symbol to inherit the class.
    ["~ text-red-500"] This is class inherited from above paragraph
  3. Compile to HTML.
  4. The child element does not inherit the class or apply the overridden styles.

Expected behavior
When a child element uses the ["~"] syntax, it should inherit the parent’s classes while allowing the user to override specific classes as needed.

Additional context
This feature will provide flexibility for users to reuse parent classes efficiently, reducing redundancy in styling across nested elements.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions