Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
eeab863
chore: adds docusaurus and updates basic config
pravton Oct 28, 2026
ee84f46
chore: updates configs and packages
pravton Oct 29, 2026
ce557b8
chore: removes all unused files
pravton Oct 29, 2026
9dbe9fc
chore: version helpers/components to keep the version consistent accr…
pravton Oct 29, 2026
0a0c817
chore: adds base utils needed
pravton Oct 29, 2026
d778ee6
chore: updates config and adds scss
pravton Oct 29, 2026
c06529b
chore: adds intro and getting started docs
pravton Oct 29, 2026
2cf159d
chore: adds basic gallery demo
pravton Oct 29, 2026
9ef2705
chore: adds api docs based on readme
pravton Oct 30, 2026
b9e0ae1
chore: updates config and the basic demo
pravton Oct 30, 2026
2979c78
chore: updates side bar to auto generate and config update
pravton Oct 30, 2026
0a6e845
chore: adds category json for sidebar root page and labeling
pravton Oct 30, 2026
f90488e
chore: updates spacing
pravton Oct 30, 2026
d7c90a0
chore: adds guides docs
pravton Oct 30, 2026
12999f0
chore: adds css custom properties doc
pravton Oct 30, 2026
27f10d2
chore: adds looping gallery demo
pravton Oct 30, 2026
1049287
chore: adds thumbnail gallery demo
pravton Oct 30, 2026
54c992e
chore: adds card stack demo
pravton Oct 30, 2026
5987402
chore: updates base style to scss
pravton Oct 30, 2026
9f55632
chore: updates styling and the image sizes
pravton Oct 30, 2026
0cc44e7
chore: adds open in code open option
pravton Oct 30, 2026
9fc1571
chore: updates demo to use the open in code pen button
pravton Oct 30, 2026
6053064
chore: adds custom control demo
pravton Nov 3, 2026
aa0bf3a
chore: adds stories demo
pravton Nov 4, 2026
815158d
chore: updates demo names
pravton Nov 6, 2026
033eed4
chore: removes unrelated boilerplating comments
pravton Nov 6, 2026
4fca497
chore: updates comments
pravton Nov 6, 2026
f727078
chore: removes unrelated link
pravton Nov 6, 2026
866ad46
chore: updates to use workspace and added docs related commands
pravton Nov 6, 2026
3974529
chore: adds docs deploy workflow
pravton Nov 6, 2026
e9e7790
chore: updates package-lock to be in sync
pravton Nov 6, 2026
723599a
chore: removes branch specific run
pravton Nov 6, 2026
8ab2087
chore: updates demo content
pravton Nov 6, 2026
6704812
Update docs/docs/api/css-custom-properties.md
pravton Nov 6, 2026
7cca930
Update docs/docs/api/gallery-item.md
pravton Nov 6, 2026
011b3d9
Update docs/docs/api/gallery-item.md
pravton Nov 6, 2026
fba8ec9
Update docs/docs/api/gallery.md
pravton Nov 6, 2026
75e13af
Update docs/docs/api/gallery.md
pravton Nov 6, 2026
0033995
Update docs/docs/api/gallery-item.md
pravton Nov 6, 2026
8b70e94
Update docs/docs/api/gallery-nav.md
pravton Nov 6, 2026
b5aa00d
Update docs/docs/api/gallery-main.md
pravton Nov 6, 2026
afb9bc6
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
2647b82
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
2fac934
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
061b609
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
a7139fe
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
ac43c20
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
30ad931
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
a6a037b
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
10e6268
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
003dc8e
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
501a257
Apply suggestion from @andrewrubin
pravton Nov 9, 2026
f4f7e43
chore: removes confusing example
pravton Nov 9, 2026
4c2b5e8
chore: removes error related comments
pravton Nov 9, 2026
597425a
chore: removes style reference
pravton Nov 9, 2026
977e7be
chore: reworded the comment
pravton Nov 9, 2026
f6d468d
chore: updates action versions
pravton Nov 9, 2026
115d378
chore: updates comment regarding inactive element focus
pravton Nov 9, 2026
46c4459
chore: updated the comment improving clarity
pravton Nov 9, 2026
d12c356
chore: updates the example with render prop
pravton Nov 9, 2026
5395482
chore: removed un-used markdown page
pravton Nov 12, 2026
a849eb8
chore: updated pagination doc to refect the reason behind active item…
pravton Nov 12, 2026
a832c9c
Revert "chore: updated the comment improving clarity"
pravton Nov 12, 2026
d18e29f
chore: removed inline style suggesting reference
pravton Nov 12, 2026
660c3d5
chore: removed unrelated comment
pravton Nov 12, 2026
f75a551
chore: removed inline style related comment
pravton Nov 12, 2026
073aa18
chore: removed on change event example on the demo
pravton Nov 16, 2026
379f911
chore: updates inert related comment on accesibilty.md
pravton Nov 16, 2026
6d4d54a
chore: adds reusable mdx for snippets being used in multiple places
pravton Nov 16, 2026
e969517
chore: removed css custom prop md and combined with style.md
pravton Nov 16, 2026
ee4923a
chore: updates the wording emphasize default layout css props
pravton Nov 16, 2026
c2f357d
chore: updates comment regarding focus shift on active item
pravton Nov 16, 2026
e69b9fe
chore: updates renderNavItem example
pravton Nov 16, 2026
f97b0cd
chore: fixes broken links
pravton Nov 16, 2026
3ee8738
chore: fixes the path
pravton Nov 16, 2026
2868bf9
chore: deletes non relevant comment regarding accessibilty
pravton Nov 17, 2026
a663d7b
chore: updates default layout comment
pravton Nov 17, 2026
6bd8ebc
chore: updates logo and the footer links
pravton Nov 18, 2026
7d43378
Merge branch 'main' into feature/docs-and-demos
pravton Nov 18, 2026
ac53c91
chore: updates packages
pravton Nov 18, 2026
83bc06c
chore: updates to render the version on header and the link
pravton Nov 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 84 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Build and Deploy Documentation

on:
push:
branches:
- main
paths:
- "docs/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/deploy-docs.yml"

pull_request:
branches:
- main
paths:
- "docs/**"
- "package.json"
- "package-lock.json"
- ".github/workflows/deploy-docs.yml"

workflow_dispatch:

permissions:
contents: read

concurrency:
group: docs-${{ github.ref }}
cancel-in-progress: true

jobs:
build:
name: Build Docusaurus
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: 24
cache: npm

- name: Install dependencies
run: npm ci

- name: Build documentation
run: npm run docs:build

- name: Upload build artifact for testing
if: github.ref != 'refs/heads/main'
uses: actions/upload-artifact@v6
with:
name: docusaurus-build
path: docs/build
retention-days: 7

- name: Upload GitHub Pages artifact
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/upload-pages-artifact@v5
with:
path: docs/build

deploy:
name: Deploy to GitHub Pages
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
needs: build
runs-on: ubuntu-latest

permissions:
contents: read
pages: write
id-token: write

environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}

steps:
- name: Deploy documentation
id: deployment
uses: actions/deploy-pages@v5
20 changes: 20 additions & 0 deletions docs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Dependencies
/node_modules

# Production
/build

# Generated files
.docusaurus
.cache-loader

# Misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
34 changes: 34 additions & 0 deletions docs/.stylelintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
extends: stylelint-config-standard-scss
plugins:
- stylelint-order
rules:
block-no-empty: null
color-hex-length: null
custom-property-no-missing-var-function: null
custom-property-pattern: null
declaration-block-no-redundant-longhand-properties: null
length-zero-no-unit: null
max-nesting-depth:
- 3
- ignore:
- blockless-at-rules
- pseudo-classes
no-descending-specificity: null
no-invalid-position-at-import-rule: null
selector-class-pattern: null
selector-pseudo-class-no-unknown: null
value-no-vendor-prefix: null

order/order:
- dollar-variables
- custom-properties
- declarations
order/properties-alphabetical-order: true

scss/at-if-no-null: null
scss/at-mixin-pattern: null
scss/dollar-variable-colon-newline-after: null
scss/double-slash-comment-whitespace-inside: null
scss/no-global-function-names: null
scss/operator-no-newline-after: null
scss/operator-no-unspaced: null
43 changes: 43 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Website

This website is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.

## Installation

```bash
npm install
```

**Note**: feel free to use the package manager of your choice.

## Local Development

```bash
npm run start
```

This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.

## Build

```bash
npm run build
```

This command generates static content into the `build` directory and can be served using any static contents hosting service.

## Deployment

Using SSH:

```bash
USE_SSH=true npm run deploy
```

Not using SSH:

```bash
GIT_USER=<Your GitHub username> npm run deploy
```

If you are using GitHub Pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.
7 changes: 7 additions & 0 deletions docs/docs/api/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"label": "API",
"position": 4,
"link": {
"type": "generated-index"
}
}
57 changes: 57 additions & 0 deletions docs/docs/api/gallery-item.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
sidebar_position: 3
---

# GalleryItem

Wraps a single gallery item. It renders an `<li>` and sets the attributes and CSS custom properties the stylesheet uses to position it. Always return it from `renderGalleryItem` on [`<GalleryMain>`](/docs/api/gallery-main).

```jsx
<GalleryMain
renderGalleryItem={({ item, index, active }) => (
<GalleryItem key={item.id} index={index} active={active}>
<img src={item.image} alt={item.alt} />
</GalleryItem>
)}
/>
```
Comment thread
andrewrubin marked this conversation as resolved.
Resolved

## Props

TypeScript: `GalleryItemProps`. `GalleryItem` never sees your item data, so it takes no type argument.

| Prop | Type | Required | Description |
| --- | --- | --- | --- |
| `index` | `number` | yes | This item's index. Pass `index` through from `renderGalleryItem`. |
| `active` | `boolean` | yes | Whether this item is active. Pass `active` through from `renderGalleryItem`. |
| `children` | `ReactNode` | | The item's content. |
| `className` | `string` | | Extra class for the `<li>`. Use it with `active` for state styling. |
Any other `<li>` attributes are passed through.

## Accessibility

- Every item gets `tabIndex={-1}`, so items can receive focus to the active gallery item when the user navigates to it via a button of some sort, eg: with pagination. (the gallery uses this, see [GalleryNav](/docs/api/gallery-nav#focus)).


## Data attributes

| Attribute | Value |
| --- | --- |
| `data-item-visible` | `"true"` if the item is within the gallery's [`visibleRange`](/docs/api/gallery#visiblerange) of the active item, otherwise `"false"`. Always `"true"` when `visibleRange` is `-1`. |
| `data-was-active` | `"true"` on the item that was active before the last change. |

Style them with attribute selectors, for example `.my-slide[data-item-visible="false"]`.

## CSS custom properties

`GalleryItem` sets these inline on the `<li>`. The base stylesheet combines them into `--x`, the item's horizontal position.

| Property | Description |
| --- | --- |
| `--i` | This item's index. |
| `--center-offset` | Distance from the active item, in items (always positive). |
| `--index-offset` | Distance from the active item, in items: negative before it, positive after it. |
| `--side` | `-1` before the active item, `0` for the active item, `1` after it. |
| `--active` | `1` for the active item, otherwise `0`. |

They're handy in your own CSS, for example `transition-delay: calc(0.05s * var(--center-offset))`. The full list, including `--x`, is in [Styling](/docs/guides/styling).
76 changes: 76 additions & 0 deletions docs/docs/api/gallery-main.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
sidebar_position: 2
---

import Tabs from "@theme/Tabs"
import TabItem from "@theme/TabItem"

# GalleryMain

The main gallery view. It renders a `<ul>` and calls `renderGalleryItem` once for each entry in the `items` array passed to [`<Gallery>`](/docs/api/gallery). Must be used inside a `<Gallery>`.

<Tabs groupId="code-language">
<TabItem value="ts" label="TypeScript" default>

```tsx
<GalleryMain<Item>
renderGalleryItem={({ item, index, active }) => (
<GalleryItem key={item.id} index={index} active={active}>
<img src={item.image} alt={item.alt} />
</GalleryItem>
)}
/>
```

</TabItem>
<TabItem value="js" label="JavaScript">

```jsx
<GalleryMain
renderGalleryItem={({ item, index, active }) => (
<GalleryItem key={item.id} index={index} active={active}>
<img src={item.image} alt={item.alt} />
</GalleryItem>
)}
/>
```

</TabItem>
</Tabs>

## Props

TypeScript: `GalleryMainProps<T>`. Pass your item type as `<GalleryMain<Item>>`, or `item` is `unknown`; the [TypeScript guide](/docs/guides/typescript) explains why.

| Prop | Type | Required | Description |
| --- | --- | --- | --- |
| `renderGalleryItem` | `(args: RenderGalleryItemArgs<T>) => ReactNode` | yes | Called for each item. Must return a [`<GalleryItem>`](/docs/api/gallery-item). |
| `className` | `string` | | Extra class for the `<ul>`. |
Any other `<ul>` attributes (`id`, `aria-label`, `data-*`, ...) are passed through to the list.

## renderGalleryItem arguments

TypeScript: `RenderGalleryItemArgs<T>`.

| Field | Type | Description |
| --- | --- | --- |
| `item` | `T` | This item's entry from the `items` array. |
| `index` | `number` | This item's index. |
| `active` | `boolean` | Whether this item is the active one. |
| `activeIndex` | `number` | Index of the active item. |

## Layout

With the base stylesheet, the `<ul>` is a CSS grid with a single cell. Every item sits in that cell and is moved sideways with a `transform` built from [Styling](/docs/guides/styling). Remove the transform in your own item CSS and the items stack instead, which is a starting point for a fading gallery.

`GalleryMain` sets two of those properties on the `<ul>`: `--selected` (the active index) and `--total` (the number of items).

## Dragging

When `<Gallery>` has `draggable` on (the default), `GalleryMain` handles pointer events on the list:

- A horizontal drag of more than 10px starts moving the items with the pointer, through `--touch-offset`.
- If the pointer moves more than 20px vertically before a horizontal drag starts, it is treated as page scrolling and the drag is ignored.
- Releasing after a drag longer than `swipeThreshold` (50px) goes to the next item (dragged left) or the previous one (dragged right). Shorter drags snap back.

The base stylesheet sets `touch-action: pan-y` on draggable galleries so vertical page scrolling still works on touch screens.
Comment thread
pravton marked this conversation as resolved.
Resolved
Loading
Loading