Layout wrapper that snaps sections to the full viewport height.
Component preview not available for: scroll-snap-section
scroll-snap-section
Ensure the filename matches ScrollSnapSection.astro
ScrollSnapSection.astro
Copy the full block below to use this component with its imports.
--- import { ScrollSnapPage } from 'astro-component-kit'; --- <ScrollSnapSection>Content</ScrollSnapSection>
If you are not using the npm package, create a new file src/components/lib/ScrollSnapPage.astro and paste the following code:
src/components/lib/ScrollSnapPage.astro
--- --- <div class="snap-wrap"><slot /></div> <style> .snap-wrap { height: 100vh; overflow-y: scroll; scroll-snap-type: y mandatory; } .snap-wrap :global(section) { height: 100vh; scroll-snap-align: start; display: flex; align-items: center; justify-content: center; } </style>
ScrollSnapPage.astro