MCPcopy Create free account
hub / github.com/adobe/react-spectrum / SnapPoint

Function SnapPoint

packages/react-aria-components/src/Sheet.tsx:604–620  ·  view source on GitHub ↗
({point, align, axis}: SnapPointProps)

Source from the content-addressed store, hash-verified

602}
603
604function SnapPoint({point, align, axis}: SnapPointProps) {
605 let mainUnit = axis === 'y' ? 'dvh' : 'dvw';
606 let offset = toLength(point);
607 return (
608 <div
609 style={{
610 position: 'absolute',
611 top: axis === 'y' ? offset : 0,
612 left: axis === 'x' ? offset : 0,
613 scrollSnapAlign: align,
614 // A full viewport along the swipe axis so its start/end edge lands at the snap position.
615 width: axis === 'x' ? `100${mainUnit}` : 1,
616 height: axis === 'y' ? `100${mainUnit}` : 1
617 }}
618 />
619 );
620}
621
622interface DetentPointProps {
623 point: number | string;

Callers

nothing calls this directly

Calls 1

toLengthFunction · 0.85

Tested by

no test coverage detected