Skip to content

feat(components): [button] add dashed prop#22738

Merged
rzzf merged 16 commits into
element-plus:devfrom
lxKylin:input-dashed
Feb 3, 2026
Merged

feat(components): [button] add dashed prop#22738
rzzf merged 16 commits into
element-plus:devfrom
lxKylin:input-dashed

Conversation

@lxKylin
Copy link
Copy Markdown
Contributor

@lxKylin lxKylin commented Nov 9, 2025

Please make sure these boxes are checked before submitting your PR, thank you!

  • Make sure you follow contributing guide English | (中文 | Español | Français).
  • Make sure you are merging your commits to dev branch.
  • Add some descriptions and refer to relative issues for your PR.

钉钉录屏_2025-11-09 210451

Summary by CodeRabbit

  • New Features

    • Added a dashed button style, configurable per-button and globally via ConfigProvider.
  • Documentation

    • Updated Button and ConfigProvider docs to document the dashed attribute (v2.13.3+).
  • Examples

    • Added examples showcasing dashed button variants and a config control for dashed.
  • Tests

    • Added tests verifying dashed styling and config precedence.
  • Style

    • Introduced dashed styling variants and theme support for hover/active/disabled states.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 9, 2025

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Nov 9, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/element-plus/element-plus@22738
npm i https://pkg.pr.new/element-plus/element-plus@22738
yarn add https://pkg.pr.new/element-plus/[email protected]

commit: 853fb46

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 9, 2025

🧪 Playground Preview: https://element-plus.run/?pr=22738
Please comment the example via this playground if needed.

@rzzf rzzf changed the title feat(components): [input] add the dashed attribute feat(components): [button] add the dashed attribute Nov 11, 2025
Comment thread packages/components/button/src/use-button.ts
Comment thread packages/components/button/__tests__/button.test.tsx
Comment thread packages/theme-chalk/src/button.scss Outdated
Comment thread packages/components/button/__tests__/button.test.tsx Outdated
@rzzf rzzf added the conflict pending need to resolve conflicts label Nov 23, 2025
@github-actions
Copy link
Copy Markdown
Contributor

@lxKylin This PR has conflicts, please resolve them.

@github-actions github-actions Bot removed the conflict pending need to resolve conflicts label Nov 23, 2025
Comment thread docs/en-US/component/tabs.md Outdated
@rzzf
Copy link
Copy Markdown
Member

rzzf commented Nov 27, 2025

Based on implementations in other component libraries, I think the background color should be removed for the dashed state. WDYT?

Normal
image

Hover / Focus
image

@lxKylin
Copy link
Copy Markdown
Contributor Author

lxKylin commented Nov 27, 2025

Based on implementations in other component libraries, I think the background color should be removed for the dashed state. WDYT?

Normal image

Hover / Focus image

钉钉录屏_2025-11-27 194514
I think so, too.

Comment thread packages/theme-chalk/src/mixins/_button.scss Outdated
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 1, 2026

📝 Walkthrough

Walkthrough

Added a new "dashed" styling variant for Button: prop and ConfigProvider support, composable exposure, component class binding, SCSS mixins and theme styles, docs/examples updates, and tests verifying dashed behavior and precedence.

Changes

Cohort / File(s) Summary
Documentation
docs/en-US/component/button.md, docs/en-US/component/config-provider.md
Documented new dashed option (version ^2.13.3) in Button API and ConfigProvider button attributes; updated examples and API tables.
Examples
docs/examples/button/basic.vue, docs/examples/config-provider/button.vue
Added dashed buttons to the basic demo and a dashed checkbox bound to config.dashed in the ConfigProvider example.
Component API & Logic
packages/components/button/src/button.ts, packages/components/button/src/use-button.ts, packages/components/button/src/button.vue
Added public dashed prop, added dashed support to ButtonConfigContext, computed _dashed in useButton (prop → config → false), and applied .is-dashed class in the component.
Styling / Theme
packages/theme-chalk/src/mixins/_button.scss, packages/theme-chalk/src/button.scss
Introduced button-dashed($type) mixin, added &.is-dashed variant, and theme CSS for dashed border and hover/active color variables.
Tests
packages/components/button/__tests__/button.test.tsx, packages/components/config-provider/__tests__/config-provider.test.tsx
Added tests asserting .is-dashed class and that component dashed prop overrides ConfigProvider dashed setting (including nextTick transitions).
Manifest
package.json
Manifest touched (analyzed in diff context).

Sequence Diagram(s)

sequenceDiagram
    participant App as App / Example
    participant Config as ConfigProvider
    participant Button as ElButton
    participant Use as useButton
    participant Theme as Theme (SCSS)

    App->>Config: provide button config (dashed?: boolean)
    App->>Button: render <el-button :dashed="..."> (may pass prop)
    Button->>Use: resolve dashed (prop ?? Config.dashed ?? false)
    Use-->>Button: return _dashed
    Button->>Theme: render with class .is-dashed when _dashed true
    Theme-->>Button: apply dashed styles (border-style: dashed, hover/active vars)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 I nibble code and add a dash,
Little borders leap and flash,
Props and config, hand in paw,
Classes bloom, the styles say "ta-da!" —
A tiny hop, a joyful dash.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description completes the required checklist items but lacks substantive details about the change itself; it only includes a screenshot reference without explanation. Add a brief description of what the dashed attribute does and why it was added, beyond just checking the contributor checklist items.
✅ Passed checks (2 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'feat(components): [button] add dashed prop' accurately and clearly describes the main change: adding a new dashed property to the button component.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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 and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@docs/en-US/component/config-provider.md`:
- Around line 112-119: Update the button config object signature
`{autoInsertSpace?: boolean, type?: string, plain?: boolean, round?: boolean}`
to include `text?: boolean` and `dashed?: boolean` (with version markers
^(2.11.0) and ^(2.13.3) respectively) so the signature matches the Button
Attribute table; ensure the updated signature reads `{autoInsertSpace?: boolean,
type?: string, plain?: boolean, round?: boolean, text?: boolean ^(2.11.0),
dashed?: boolean ^(2.13.3)}` and keep formatting consistent with the surrounding
docs.

In `@packages/theme-chalk/src/mixins/_button.scss`:
- Around line 63-132: The dashed button mixin button-dashed currently gives type
variants a filled look because each variant's 'bg-color' is set to a light-9
token; change those bg-color entries (inside the $button-color-types map for '',
'hover', and 'active') to use a transparent/blank token instead of 'light-9' so
dashed variants remain border-only, and ensure the disabled block (is-disabled)
still uses the intended getCssVar fallbacks only where a real background is
required; update the map entries referenced by `@each` ($button-color-types) and
the keys 'bg-color' so the included css-var-from-global and subsequent getCssVar
calls pick up the transparent value for dashed types.

Comment thread docs/en-US/component/config-provider.md
Comment thread packages/theme-chalk/src/mixins/_button.scss
Copy link
Copy Markdown
Member

@Dsaquel Dsaquel left a comment

Choose a reason for hiding this comment

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

LGTM

@rzzf rzzf changed the title feat(components): [button] add the dashed attribute feat(components): [button] add dashed prop Feb 3, 2026
@rzzf rzzf merged commit f154ce2 into element-plus:dev Feb 3, 2026
17 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 3, 2026

@lxKylin Thanks for your contribution! ❤️

@element-bot element-bot mentioned this pull request Feb 28, 2026
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants