uf-gzj/openspace-claude-evolution/react-localstorage-keyboard-nav

Claude Code and agent skill by uf-gzj/openspace-claude-evolution

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Create React components with localStorage persistence and keyboard navigation support

Install

npx vskill@latest install uf-gzj/openspace-claude-evolution/react-localstorage-keyboard-nav

SKILL.md

The same SKILL.md was published earlier as uf-gzj/openspace-claude-evolution/react-localstorage-keyboard-nav.

React Components with localStorage Persistence & Keyboard Navigation

This skill guides you through creating reusable React components that:

  1. Persist state to localStorage
  2. Implement keyboard navigation
  3. Follow modal/command palette patterns

Core Pattern

typescript
// 1. Define localStorage hooks
const useLocalStorage = (key: string, initialValue: any) => {
const [value, setValue] = useState(() => {
const stored = localStorage.getItem(key);
return stored ? JSON.parse(stored) : initialValue;
});
useEffect(() => {
localStorage.setItem(key, JSON.stringify(value));
}, [key, value]);
return [value, setValue];
};
// 2. Implement keyboard navigation
const useKeyboardNav = (items: any[], onSelect: (item: any) => void) => {
const [selectedIndex, setSelectedIndex] = useState(0);
const handleKeyDown = (e: KeyboardEvent) => {
if (e.key === 'ArrowDown') {
setSelectedIndex(prev => Math.min(prev + 1, items.length - 1));
} else if (e.key === 'ArrowUp') {
setSelectedIndex(prev => Math.max(prev - 1, 0));
} else if (e.key === 'Enter') {
onSelect(items[selectedIndex]);
}
};
useEffect(() => {
window.addEventListener('keydown', handleKeyDown);
return () => window.removeEventListener('keydown', handleKeyDown);
}, [selectedIndex, items]);
return { selectedIndex };
};

Implementation Steps

  1. Create Component Scaffolding

``bash mkdir -p src/components/{Modal,CommandPalette} touch src/components/Modal/SettingsModal.tsx touch src/components/CommandPalette/CommandPalette.tsx ``

  1. Implement localStorage Persistence

``typescript // SettingsModal.tsx const SettingsModal = () => { const [settings, setSettings] = useLocalStorage('app-settings', DEFAULT_SETTINGS); // ... modal implementation }; ``

  1. Add Keyboard Navigation

``typescript // CommandPalette.tsx const CommandPalette = ({ commands }) => { const { selectedIndex } = useKeyboardNav(commands, (cmd) => cmd.action()); // ... render commands with highlighted selectedIndex }; ``

  1. Export Components

``typescript // src/components/index.ts export * from './Modal/SettingsModal'; export * from './CommandPalette/CommandPalette'; ``

Best Practices

  • Create a settings-keys.ts file to manage localStorage keys
  • Use TypeScript interfaces for settings/commands
  • Implement proper focus management for accessibility

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
5

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/uf-gzj/openspace-claude-evolution/react-localstorage-keyboard-nav/badge)](https://verified-skill.com/skills/uf-gzj/openspace-claude-evolution/react-localstorage-keyboard-nav)

Something wrong with this skill or its page? Tell us.