[ @sdxc/u/effects ]
border-end-start-radius
Applies a radius from the radius scale, or a raw CSS length, to one logical corner — for shapes that round three corners uniformly and differentiate the fourth, like a chat bubble's tail.
import { roundedCorner } from "@sdxc/u/effects";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.roundedCorner("end-start", "xs") | css({ borderEndStartRadius: "var(--ui-radius-xs, 0.125rem)" }) |
Examples
Basic example
Use roundedCorner(corner, step) to round one corner, named by its block and inline side, like "start-start" for the top left in English:
<div mix={[...]}>
<div mix={[roundedCorner("start-start", "xl"), ...]}>start-start</div>
<div mix={[roundedCorner("start-end", "xl"), ...]}>start-end</div>
<div mix={[roundedCorner("end-start", "xl"), ...]}>end-start</div>
<div mix={[roundedCorner("end-end", "xl"), ...]}>end-end</div>
</div>Shaping a chat bubble
Round three corners and leave the fourth square to point a message bubble at its sender:
<p
mix={[
roundedCorner("start-start", "xl"),
roundedCorner("start-end", "xl"),
roundedCorner("end-end", "xl"),
...,
]}
>
See you at the station at six?
</p>Following the writing direction
Logical corners follow the writing direction, so "start-start" is the top right corner inside dir="rtl":
<div mix={[...]}>
<div dir="ltr" mix={[roundedCorner("start-start", "xl"), ...]}>
ltr
</div>
<div dir="rtl" mix={[roundedCorner("start-start", "xl"), ...]}>
rtl
</div>
</div>Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.roundedCorner("end-start", "xs"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.roundedCorner("end-start", "xs"))Customizing your theme
Customizing radii
Redefine a --ui-radius-* variable to change a step, or declare a new one:
:root {
--ui-radius-2xl: 1rem;
}declare module "@sdxc/u" {
interface Radii {
"2xl": true;
}
}The new name is then accepted wherever the scale is:
rounded("2xl")Signature
u.roundedCorner(corner: LogicalCorner, name?: RadiusName | (string & {}))