SearchCtrlK

  • ↑↓navigate
  • ↵open
  • escclose

Can’t find it? Contact us

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.

tsx
import { roundedCorner } from "@sdxc/u/effects";

Quick reference

Every documented call, beside the CSS it emits.

CallCSS
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:

start-start
start-end
end-start
end-end
tsx
<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:

See you at the station at six?

tsx
<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":

ltr
rtl
tsx
<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.

typescript
u.hover(u.roundedCorner("end-start", "xs"))

Responsive design

Wrap the call in a container query to scope it to one width.

typescript
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:

css
:root {
	--ui-radius-2xl: 1rem;
}
typescript
declare module "@sdxc/u" {
	interface Radii {
		"2xl": true;
	}
}

The new name is then accepted wherever the scale is:

typescript
rounded("2xl")

Signature

typescript
u.roundedCorner(corner: LogicalCorner, name?: RadiusName | (string & {}))
@sdxc/u

Can’t find it? Contact us