Skip to content

chore: Style api docs tools#4778

Open
pan-kot wants to merge 1 commit into
mainfrom
style-api-docs
Open

chore: Style api docs tools#4778
pan-kot wants to merge 1 commit into
mainfrom
style-api-docs

Conversation

@pan-kot

@pan-kot pan-kot commented Jul 23, 2026

Copy link
Copy Markdown
Member

Description

Depends on cloudscape-design/component-toolkit#233

The new task generates style API (v2) docs per component. I tested it by adding style API v2 to the progress bar component, which emitted the following docs (./lib/components-definitions/progress-bar.json):

{
  "slots": [
    { "name": "root", "tokens": ["color-background"] },
    { "name": "label", "tokens": ["color-text"] },
    { "name": "description", "tokens": ["color-text"] },
    { "name": "additionalInfo", "tokens": ["color-text"] }
  ]
}

Source (./src/progress-bar/styles.scss):

@use '@cloudscape-design/component-toolkit/internal/style-api' as style-api;

// ...

$root-tokens: style-api.resolve((color-background), public);
$text-tokens: style-api.resolve((color-text), public);
@include style-api.register($root-tokens, $text-tokens);

// Insert style API docs markers
@include style-api.docs('root', $root-tokens);
@include style-api.docs('label', $text-tokens);
@include style-api.docs('description', $text-tokens);
@include style-api.docs('additionalInfo', $text-tokens);

.root {
  background: var(#{style-api.read($root-tokens, color-background)}, transparent);
}

.label {
  color: var(#{style-api.read($text-tokens, color-text)}, #{awsui.$color-text-label});
}

.description {
  color: var(#{style-api.read($text-tokens, color-text)}, #{awsui.$color-text-body-secondary});
}

.additional-info {
  color: var(#{style-api.read($text-tokens, color-text)}, #{awsui.$color-text-body-secondary});
}

// ...

How has this been tested?

Review checklist

The following items are to be evaluated by the author(s) and the reviewer(s).

Correctness

  • Changes include appropriate documentation updates.
  • Changes are backward-compatible if not indicated, see CONTRIBUTING.md.
  • Changes do not include unsupported browser features, see CONTRIBUTING.md.
  • Changes were manually tested for accessibility, see accessibility guidelines.

Security

Testing

  • Changes are covered with new/existing unit tests?
  • Changes are covered with new/existing integration tests?

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@pan-kot
pan-kot requested a review from avinashbot July 23, 2026 11:03
@pan-kot
pan-kot marked this pull request as ready for review July 23, 2026 14:52
@pan-kot
pan-kot requested a review from a team as a code owner July 23, 2026 14:52
@pan-kot
pan-kot removed the request for review from a team July 23, 2026 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant