use-kbd 0.8.0 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -137,6 +137,47 @@ useAction('nav:prev', {
137
137
 
138
138
  Users can edit bindings in the `ShortcutsModal`. Changes persist to localStorage using the `storageKey` you provide.
139
139
 
140
+ #### Export/Import Bindings
141
+
142
+ Users can export their customized bindings as JSON and import them in another browser or device:
143
+
144
+ ```tsx
145
+ <ShortcutsModal editable /> // Shows Export/Import buttons
146
+ ```
147
+
148
+ The exported JSON contains:
149
+ - `version` – Library version for compatibility
150
+ - `overrides` – Custom key→action bindings
151
+ - `removedDefaults` – Default bindings the user removed
152
+
153
+ Programmatic access via the registry:
154
+
155
+ ```tsx
156
+ const { registry } = useHotkeysContext()
157
+
158
+ // Export current customizations
159
+ const data = registry.exportBindings()
160
+
161
+ // Import (replaces current customizations)
162
+ registry.importBindings(data)
163
+ ```
164
+
165
+ Customize the footer with `footerContent`:
166
+
167
+ ```tsx
168
+ <ShortcutsModal
169
+ editable
170
+ footerContent={({ exportBindings, importBindings, resetBindings }) => (
171
+ <div className="my-custom-footer">
172
+ <button onClick={exportBindings}>Download</button>
173
+ <button onClick={importBindings}>Upload</button>
174
+ </div>
175
+ )}
176
+ />
177
+ ```
178
+
179
+ Pass `footerContent={null}` to hide the footer entirely.
180
+
140
181
  ## Components
141
182
 
142
183
  ### `<HotkeysProvider>`
@@ -161,10 +202,11 @@ Note: Modal/omnibar trigger bindings are configured via component props (`defaul
161
202
  Displays all registered actions grouped by category. Users can click bindings to edit them on desktop.
162
203
 
163
204
  ```tsx
164
- <ShortcutsModal groups={[
165
- { id: 'nav', label: 'Navigation' },
166
- { id: 'edit', label: 'Editing' },
167
- ]} />
205
+ <ShortcutsModal
206
+ editable // Enable editing, Export/Import buttons
207
+ groups={{ nav: 'Navigation', edit: 'Editing' }}
208
+ hint="Click any shortcut to customize"
209
+ />
168
210
  ```
169
211
 
170
212
  ### `<Omnibar>`