Skip to content

Commit 8ce1c9a

Browse files
committed
docs: add custom label example
1 parent cc7baef commit 8ce1c9a

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

docs/advanced.md

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,30 @@ augmentations are applied before the lightbox starts rendering.
140140

141141
For example, you can add a toolbar button using the following augmentation:
142142

143-
```jsx
144-
import { addToolbarButton } from "yet-another-react-lightbox";
143+
```tsx
144+
import { addToolbarButton, IconButton } from "yet-another-react-lightbox";
145+
146+
declare module "yet-another-react-lightbox" {
147+
interface Labels {
148+
"My button"?: string;
149+
}
150+
}
145151

146152
// ...
147153

148154
function MyPlugin({ augment }) {
149155
augment(({ toolbar, ...restProps }) => ({
150-
toolbar: addToolbarButton(toolbar, "my-button", <MyButton />),
156+
toolbar: addToolbarButton(
157+
toolbar,
158+
"my-button",
159+
<IconButton
160+
icon={MyIcon}
161+
label="My button"
162+
onClick={() => {
163+
// ...
164+
}}
165+
/>,
166+
),
151167
...restProps,
152168
}));
153169
}

0 commit comments

Comments
 (0)