[RFC] New Component: BorderBeam #57715
QDyanbing
announced in
RFCs - archive
Replies: 1 comment
-
|
先只留 |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Propose a new
BorderBeamcomponent in antd6.4.0.BorderBeamis a decorative wrapper component that renders a moving beam along the border of a container. It is intended for high-attention areas such as login panels, recommendation cards, AI modules, and highlighted CTA blocks.Its role is different from
Wave:Waveis interaction feedback.BorderBeamis a persistent surface effect.This capability is exposed as an explicit compositional component:
instead of a global switch or a demo-only pattern.
Motivation
In recent years, “Border Beam” has become a recognizable UI pattern across multiple component ecosystems including React, Vue, and Svelte. It is commonly used for:
There are already multiple community implementations with the same or highly similar concept, such as:
This indicates that:
At the same time, many community implementations are still demo-oriented rather than design-system-oriented:
Within antd, this pattern fits better as a composable decorative component than as a site demo or a private prop on a single component.
Goals
Card, login panels, and custom blocksclassNames/stylesWhy Component Instead of
CardPropBorderBeamshould be a standalone component rather than aCardprop like:because:
Card-only requirementFlex, custom panels, login forms, and other wrappersAPI
Common props such as
className,rootClassName, andstylefollow the antd common props contract.SemanticDOMincludes:rootbeamnumber1ReactNoderootandbeam, supports object or function formRecord<SemanticDOM, string> | (info: { props }) => Record<SemanticDOM, string>stringstring#1677ffstring#4096ffnumber0booleanfalsenumber6number0React.CSSProperties['borderRadius']booleanfalsebooleanfalsenumber60rootandbeam, supports object or function formRecord<SemanticDOM, CSSProperties> | (info: { props }) => Record<SemanticDOM, CSSProperties>Usage Examples
Basic
Custom Colors
Rounded Login Panel
Detailed Design
DOM Structure
Public semantic slots:
rootbeamStyling Model
BorderBeamfollows antd design tokens by default.Component tokens:
beamColorFrombeamColorToborderBeamWidthDefault mappings:
beamColorFrom->token.colorPrimarybeamColorTo->token.colorPrimaryHoverborderBeamWidth->token.lineWidthPer-instance props still take precedence over component tokens.
Radius Model
pathRadiuscontrols the beam track radius only. It does not write radius styles back to the wrapped content.When
pathRadiusis omitted, the component may use the following sources as track configuration fallback:style.borderRadiusstyles.root.borderRadiusFor stable and predictable usage across different wrapped components, passing
pathRadiusexplicitly is recommended.Motion Model
Implementation follows an antd-style CSS-in-JS approach:
maskis used to keep only the border ring visibleoffset-pathoffset-pathandoffset-distancedrive the motionoffset-anchoris used to keep the visible beam aligned with the track more naturallyThis keeps the implementation aligned with the current antd stack and avoids introducing an additional motion runtime.
Accessibility
The beam layer is purely decorative:
aria-hiddenpointer-events: noneWhen
prefers-reduced-motion: reduceis active, the beam effect is hidden.Performance Constraints
Because this is a persistent motion effect, the component intentionally keeps a narrow scope:
Initial Demo Set
basic.tsxcustomized-color.tsxradius.tsxnon-uniform-radius.tsxcontrolled.tsxcomponent-token.tsxReferences
Beta Was this translation helpful? Give feedback.
All reactions