Border Property
Introduction
The border property is a common attribute in the Cosy UI component library, used to set the border style of components. It supports multiple border sizes and colors, providing unified visual hierarchy.
Border Sizes
Available Options
none- No bordersm- Thin border (1px)md- Medium border (2px)lg- Thick border (4px)xl- Extra thick border (8px)
无边框
border="none"
细边框 (1px)
border="sm"
中等边框 (2px)
border="md"
粗边框 (4px)
border="lg"
超粗边框 (8px)
border="xl"
Border Colors
Available Colors
primary- Primary color bordersecondary- Secondary color borderaccent- Accent color borderneutral- Neutral color bordersuccess- Success color borderwarning- Warning color bordererror- Error color borderinfo- Info color borderbase-100- Base-100 color borderbase-200- Base-200 color borderbase-300- Base-300 color bordertransparent- Transparent bordernone- No border color
primary
borderColor="primary"
success
borderColor="success"
error
borderColor="error"
primary/50
borderColor="primary/50"
Opacity Variants
Each color supports opacity variants with the format color/opacity:
primary/10- Primary color with 10% opacityprimary/20- Primary color with 20% opacityprimary/30- Primary color with 30% opacityprimary/40- Primary color with 40% opacityprimary/50- Primary color with 50% opacityprimary/60- Primary color with 60% opacityprimary/70- Primary color with 70% opacityprimary/80- Primary color with 80% opacityprimary/90- Primary color with 90% opacity
The same opacity variants are available for all colors (secondary, accent, neutral, success, warning, error, info, base-100, base-200, base-300).
Usage
In Components
<Container border="sm">
Thin border container
</Container>
<Container border="md">
Medium border container
</Container>
<Container border="lg">
Thick border container
</Container>
<Container border="md" borderColor="primary">
Primary color border
</Container>
<Container border="lg" borderColor="success/50">
Semi-transparent success border
</Container>In Builder Pattern
const props = ContainerProps()
.border("md")
.borderColor("primary")
.build();
<Container {...props}>
Builder pattern border setting
</Container>Related Components
The following components support the border property:
Container- Container componentCard- Card componentButton- Button componentAlert- Alert componentBadge- Badge componentModal- Modal component
