Accessible React component library with Card (4 variants), Modal (portal, focus trap, ARIA), SettingsPanel, and hooks: useFocusTrap, usePrefersReducedMotion, useModal. Keyboard navigation, screen reader support, reduced motion. Create React App, PropTypes, plain CSS.
Four variants: default, elevated, outlined, compact. Interactive mode supports keyboard (Enter/Space) and click.
Keeps focus inside modal; restores on close. Tab/Shift+Tab wrap; Escape restores focus.
matchMedia('(prefers-reduced-motion: reduce)'). Respect system preference.
Reusable open/close state and optional payload.
React Card & Modal Components is an accessible React component library with Card (default, elevated, outlined, compact), Modal (createPortal, focus trap, ARIA), and SettingsPanel. Built with React 18, Create React App, PropTypes, and plain CSS. Focus trap, keyboard navigation, screen reader support, and reduced-motion friendly.
By Molla Samser (RSK World). Designer & Tester: Rima Khatun. 2026.
Semantic headings (h1, h2, h3), meta description, keywords, canonical URL, author, and Open Graph tags for React Card & Modal Components demo.
Before installing, ensure you have:
node -vnpm -vreact-card-modal.zip from the project page (use the "Download Source Code" button above) or clone the repository if you have the repo URL.
react-card-modal.zip into a folder of your choice (e.g. react-card-modal). Avoid paths with spaces or special characters.
cd react-card-modal (or your folder name). On Windows you can open the folder in File Explorer and type cmd or powershell in the address bar, or use "Open in Terminal" from your editor.
npm install. Wait until all packages are installed. This installs React, react-dom, react-scripts, and prop-types.
npm start. The app will open in your browser at http://localhost:3000. If it doesn’t, open that URL manually. Leave the terminal open while developing.
npm run build. This creates an optimized build in the build folder, ready to deploy to any static host.
npm test to run the test suite (Create React App default setup).
src/components, src/hooks, src/utils into your React projectpublic/index.html (or root HTML), add <div id="modal-root"></div> so Modal can use createPortalnpm start and choose a different port when prompted (e.g. 3001).npm cache clean --force, then npm install again. Ensure Node 14+ and a stable internet connection.#modal-root exists in your HTML and useFocusTrap ref is attached to the modal content div.id="root" exists and your entry file (e.g. index.js) renders the app into it.#modal-root, so it stacks correctly and doesn’t get clipped by overflow or z-index issues..modal-overlay.closing keyframes, but the component unmounts immediately. For a smooth close, you could add a short “closing” state and run the exit animation before unmounting.src/utils/constants.js (e.g. ARIA_LABELS, FOCUSABLE_ELEMENTS_SELECTOR) could be used inside components for consistency and easier i18n later.React Card & Modal Components is a focused, accessible React UI kit: Card (4 variants, interactive), Modal (portal, focus trap, ARIA), and SettingsPanel, plus three hooks. It’s well-structured, light on dependencies, and strong on accessibility. Ideal for learning or for production apps that need accessible cards and modals without a full design system. By Molla Samser (RSK World), 2026.
Molla Samser – Founder, RSK World. Designer & Tester: Rima Khatun. React Card & Modal Components © 2026.
rskworld.in | +91 93305 39277 | info@rskworld.com
MIT License. Use in personal and commercial projects. Attribution to Molla Samser / RSK World appreciated. See LICENSE file.