reboottime / my-turbo-packages

Build your typescript based utils or components lib using mono repo.
0 stars 0 forks source link

Build React Library for developers #15

Open reboottime opened 7 months ago

reboottime commented 7 months ago

Build React Libs for developers

Scope: This article is about building complementary lib or UI components, not building a whole design system from the ground up.

Common requirements:

  1. Provide default style and the flexibility in customizing styles
  2. Provide an unstyled directive to support resetting all styles

Examples

reboottime commented 7 months ago

Styling for component lib

Prefer headless UI

Headless UI is a new trend in defining component library stylings since almost every consumer-facing product has its own brand styling.

But if you want to provide a preset style with a customizing possibility, below is the solution.

Preset style with customization possibility

To mitigate styling conflicts, the advisable solution is to utilization data properties for style identification, mainly when default customized styles are in place, for example

[data-reach-accordion-button][disabled] {
    cursor: not-allowed;
}

Style file generation

reboottime commented 7 months ago

Communication Channel

reboottime commented 7 months ago

Package organization

Preferred example: https://github.com/reach/reach-ui