Skip to content

docs: Add corner shape and parts conventions to STYLE.md - #4130

Open
sheelah wants to merge 4 commits into
Workday:masterfrom
sheelah:add-corner-shape-and-parts-conventions
Open

docs: Add corner shape and parts conventions to STYLE.md#4130
sheelah wants to merge 4 commits into
Workday:masterfrom
sheelah:add-corner-shape-and-parts-conventions

Conversation

@sheelah

@sheelah sheelah commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes: #4128.

Adds documentation on our cornerShape stencil and when to use it for CK components. Also adds more details on parts in stencils, based on what I had in my local CLAUDE.md.

Release Category

Documentation


Checklist

For the Reviewer

  • PR title is short and descriptive
  • PR summary describes the change (Fixes/Resolves linked correctly)
  • PR Release Notes describes additional information useful to call out in a release message or removed if not applicable
  • Breaking Changes provides useful information to upgrade to this code or removed if not applicable

Where Should the Reviewer Start?

Areas for Feedback? (optional)

  • Code
  • Documentation
  • Testing
  • Codemods

Testing Manually

Screenshots or GIFs (if applicable)

Thank You Gif (optional)

@sheelah
sheelah requested a review from a team as a code owner August 7, 2026 21:38
@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

STYLE.md adds rules for cornerShapeStencil, buttonStencil.vars.borderRadius, supported radius tokens, and stencil exclusions. It also documents stencil part naming, ownership, and prop-spread ordering.

Changes

STYLE.md stencil guidance

Layer / File(s) Summary
Corner-shape stencil rules
STYLE.md
Documents progressive corner-shape styling for eligible border-radius stencils, including button-specific guidance and supported or excluded radius tokens.
Stencil parts conventions
STYLE.md
Documents camelCase part keys, kebab-case data-part values, multi-part ownership, split-file ownership, and stencil.parts ordering before handleCsProp.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Possibly related PRs

Suggested labels: automerge

Suggested reviewers: mannycarrera4, josh-bagwell

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The added parts conventions are not covered by the linked issue, which only requests cornerShape guidance [#4128]. Move the parts conventions to a separate pull request or link an issue that explicitly includes this scope.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes add the requested guidance for using corner shape stencils in STYLE.md [#4128].
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly describes the documentation added for corner shape and parts conventions in STYLE.md.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sheelah
sheelah requested a review from mannycarrera4 August 7, 2026 21:40
@sheelah sheelah added the ready for review Code is ready for review label Aug 7, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@STYLE.md`:
- Line 159: Add the missing period after “etc.” in the parenthetical phrase so
the sentence ends with “etc.).”
- Around line 221-223: Update the prop-spread guidance to match handleCsProp’s
behavior: spread handleCsProp(elemProps, ...) before stencil.parts.x when the
stencil part identifier must take precedence, or revise the guarantee to
explicitly allow consumer data-part overrides. Preserve the documented ordering
for fixed props that must override handleCsProp.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 41da1d37-d11a-4e09-a4a5-19e55d1a2f8f

📥 Commits

Reviewing files that changed from the base of the PR and between 28626e6 and ea57129.

📒 Files selected for processing (1)
  • STYLE.md

Comment thread STYLE.md
[corner-shape](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/corner-shape)
to components that use border-radius under certain conditions (see below), using a
`cornerShapeStencil`. This applies to any stencil with a border radius
(inputs, cards, menu items, buttons, etc). The one exception is a stencil that already extends

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Add the period after etc..

Line 159 should use etc.).

Proposed fix
- (inputs, cards, menu items, buttons, etc). The one exception is a stencil that already extends
+ (inputs, cards, menu items, buttons, etc.). The one exception is a stencil that already extends
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
(inputs, cards, menu items, buttons, etc). The one exception is a stencil that already extends
(inputs, cards, menu items, buttons, etc.). The one exception is a stencil that already extends
🧰 Tools
🪛 LanguageTool

[style] ~159-~159: In American English, abbreviations like “etc.” require a period.
Context: ...us (inputs, cards, menu items, buttons, etc). The one exception is a stencil that a...

(ETC_PERIOD)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@STYLE.md` at line 159, Add the missing period after “etc.” in the
parenthetical phrase so the sentence ends with “etc.).”

Source: Linters/SAST tools

Comment thread STYLE.md
Comment on lines +221 to +223
- Spread `{...stencil.parts.x}` **before** `handleCsProp(elemProps, ...)` so a consumer-supplied
prop doesn't accidentally override `data-part` unless you intend that. A fixed prop that must win
(e.g. `variant="secondary"`) goes *after* `handleCsProp` instead.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail
rg -n -A50 -B5 'function handleCsProp' modules/styling/lib/cs.ts
rg -n -C3 'Stencil\.parts\.' modules --glob '*.tsx'

Repository: Workday/canvas-kit

Length of output: 31081


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== STYLE.md lines =="
sed -n '200,235p' STYLE.md

echo "== csToProps and handleCsProp complete implementation =="
sed -n '780,940p' modules/styling/lib/cs.ts

echo "== focused real JSX examples around suggested pattern =="
rg -n -C4 '\{\.\.\.handleCsProp\(.*\}\n.*\{\.\.\.stencil\.parts\.' modules --glob '*.tsx' || true
rg -n -C4 '\{\.\.\.stencil\.parts\..*\n.*\{\.\.\.handleCsProp\(.*\}' modules --glob '*.tsx' || true

Repository: Workday/canvas-kit

Length of output: 10396


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== csToProps implementation =="
rg -n -B10 -A24 '^function csToProps|const csToProps|export.*csToProps' modules/styling/lib/cs.ts

echo "== focused JSX examples =="
python3 - <<'PY'
import pathlib
needle1 = '{...stencil.parts.'
needle2 = '{...handleCsProp('
for p in pathlib.Path('modules').rglob('*.tsx'):
    text = p.read_text(errors='ignore').splitlines()
    for i,line in enumerate(text,1):
        if needle2 in line:
            # collect next spreads on subsequent lines until comment block or blank-like
            j=i+1
            while j <= len(text) and (text[j-1].strip().endswith(',') or text[j-1].strip().startswith('{...')):
                if needle1 in text[j-1] or needle2 in text[j-1]:
                    print(f'{p}:{j-1}-{j}: {text[j-1].strip()}')
                    break
                if i-1 > 0 and ('...' in text[j-1] or 'handleCsProp' in text[j-1] or text[j-1].strip().startswith('{')):
                    continue
                break
PY

echo "== simple object-spread semantics probe =="
node - <<'JS'
const stencilPart = {"data-part": "my-part"};
const restProps = {"data-part": "consumer-overridden", "other": "kept"};
const returnProps = {"className": "my-cls", "style": {}, "data-part": "generated"};
console.log(JSON.stringify({
  current_order: {...stencilPart, ...returnProps, ...restProps},
  reordered_winning_stencil_order: {...returnProps, ...restProps, ...stencilPart}
}, null, 2));
JS

Repository: Workday/canvas-kit

Length of output: 148


🏁 Script executed:

#!/usr/bin/env bash
set -euo pipefail

echo "== csToProps implementation =="
rg -n -B10 -A24 'csToProps\s*=' modules/styling/lib/cs.ts || true
rg -n -B10 -A24 'csToProps\(' modules/styling/lib/cs.ts || true
rg -n -B10 -A24 'function csToProps|const csToProps' modules/styling/lib/cs.ts || true

echo "== Node object spread behavior =="
node - <<'JS'
const stencilPart = {"data-part": "my-part"};
const returnProps = {"className": "my-cls", "style": {}, "data-part": "generated"};
const restProps = {"data-part": "consumer-overridden", "other": "kept"};
const current_order = {...stencilPart, ...returnProps, ...restProps};
const reordered_winning_stencil_order = {...returnProps, ...restProps, ...stencilPart};
console.log(JSON.stringify({
  current_order,
  reordered_winning_stencil_order
}, null, 2));
JS

Repository: Workday/canvas-kit

Length of output: 6223


Reverse the spread order or update the guarantee.

handleCsProp extracts elemProps['data-part'] into restProps and then spreads restProps at the end. Spreading {...stencil.parts.x} before handleCsProp(elemProps, ...) allows a consumer-supplied data-part to override the stencil part identifier. If the stencil part must win, spread handleCsProp(...) first and {...stencil.parts.x} second.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@STYLE.md` around lines 221 - 223, Update the prop-spread guidance to match
handleCsProp’s behavior: spread handleCsProp(elemProps, ...) before
stencil.parts.x when the stencil part identifier must take precedence, or revise
the guarantee to explicitly allow consumer data-part overrides. Preserve the
documented ordering for fixed props that must override handleCsProp.

@cypress

cypress Bot commented Aug 7, 2026

Copy link
Copy Markdown

Workday/canvas-kit    Run #11476

Run Properties:  status check passed Passed #11476  •  git commit 795544fd2e ℹ️: Merge ea5712936a72887ce6f42dc62156b9a32085ce2f into 28626e60008775fce9a562944be7...
Project Workday/canvas-kit
Branch Review add-corner-shape-and-parts-conventions
Run status status check passed Passed #11476
Run duration 02m 32s
Commit git commit 795544fd2e ℹ️: Merge ea5712936a72887ce6f42dc62156b9a32085ce2f into 28626e60008775fce9a562944be7...
Committer Sheelah Brennan
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 17
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 812
View all changes introduced in this branch ↗︎
UI Coverage  19.57%
  Untested elements 1531  
  Tested elements 370  
Accessibility  99.47%
  Failed rules  5 critical   5 serious   0 moderate   2 minor
  Failed elements 72  

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready for review Code is ready for review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cornerShape stencil guidance to STYLE.md

1 participant