[ @sdxc/u/overflow ]
overflow-y
Applies overflow-y, independently of the inline axis.
import { overflowY } from "@sdxc/u/overflow";Quick reference
Every documented call, beside the CSS it emits.
| Call | CSS |
|---|---|
u.overflowY("auto") | css({ overflowY: "auto" }) |
Examples
Basic example
Use overflowY("auto") to let an element scroll vertically when its content is taller than it is. Scroll the box:
This paragraph is taller than its box, so the last lines of it do not fit. Scroll to read the rest, while the page around the box stays exactly where it is.
<div mix={[overflowY("auto"), bs(24), is(72), maxIs("100%"), ...]}>
<p mix={[...]}>
This paragraph is taller than its box, so the last lines of it do not fit. Scroll to read
the rest, while the page around the box stays exactly where it is.
</p>
</div>Scrolling always
Use overflowY("scroll") to always show a vertical scrollbar, where the operating system draws one, even when the content fits:
This short text fits.
<div mix={[overflowY("scroll"), bs(24), is(64), ...]}>
<p mix={[...]}>This short text fits.</p>
</div>Clipping vertically
Call overflowY(), which applies hidden, to clip content that is taller than its element:
This paragraph is taller than its box, so the last lines of it do not fit. Scroll to read the rest, while the page around the box stays exactly where it is.
<div mix={[overflowY(), bs(24), is(72), maxIs("100%"), ...]}>
<p mix={[...]}>
This paragraph is taller than its box, so the last lines of it do not fit. Scroll to read
the rest, while the page around the box stays exactly where it is.
</p>
</div>Applying on a state
Wrap the call in a state utility to scope it to one selector.
u.hover(u.overflowY("auto"))Responsive design
Wrap the call in a container query to scope it to one width.
u.at("md", u.overflowY("auto"))Signature
u.overflowY(value?: OverflowValue)