Autodesk / Autodesk/hig

Enable overriding stylesheet for themable components

Open
#1,210 6 comments 0 reactions 0 assignees View on GitHub
needs api design theming
Dominant language
JavaScript
Stars
193
Forks
112
PR merge metrics
No merged PRs in 30d

Description

As a developer
I can override the style of an individual component instance
so I can tweak it as necessary

---

I think we will likely be asked to support this, and I think it's a reasonable thing for teams to expect. That said I have some concerns about it.

My main concern is that it represents a huge new API surface area. The more surface area we expose, the less flexible/more breaky our library gets.

- How might we designate a prop as use-at-your-own-risk?
- What other ways might we support overriding one-off?
- Should we just let them use CSS instead?

_Shotgun does something like this_
```
function myInputStylesheet(stylesheet, props, themeData) {
return {
...stylesheet, input: {
...stylehseet.input,
backgroundColor: props.hasFocus ? "blue" : "transparent"
}
}
}
}

function MyInput(props) {
return
}
```

---

### Dev notes

For reference, A subcomponent of `Flyout` supports this approach and `Tooltip` uses it.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing stylesheet override approach in the Flyout subcomponent and how Tooltip uses it. Compare those entry points with the proposed per-instance stylesheet function and review the open design questions before choosing a direction. Done requires an agreed API or alternative for one-off component styling, with its scope and tests documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
design, frontend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.