ExportModal component provides a comprehensive theme export interface, allowing users to export their theme configurations to various formats and platforms including CSS, Tailwind CSS, SCSS, SwiftUI, and React Native.
Props
Controls the visibility of the export modal.
Callback function called when the modal should close. Called after the closing animation completes (200ms delay).
Usage
Features
Export Formats
The modal supports 5 export formats:CSS
Generates CSS custom properties (variables) for the theme colors. Light mode only:src/components/ExportModal.tsx:113-122
Tailwind CSS
Generates Tailwind configuration in two versions: Tailwind v4.2 (default) - Uses@theme directive:
src/components/ExportModal.tsx:124-141
SCSS
Generates SCSS variables and color maps:src/components/ExportModal.tsx:143-151
SwiftUI
Generates SwiftUI color definitions: Single mode:src/components/ExportModal.tsx:153-188
React Native
Generates TypeScript color constants:src/components/ExportModal.tsx:190-207
Export Modes
Choose which theme mode(s) to export:- Light - Export only light theme colors
- Dark - Export only dark theme colors
- Both - Export both themes with appropriate syntax for the selected format
src/components/ExportModal.tsx:73-78
Color Formats
Select the color format to use in the exported code:- HEX - Hexadecimal color codes (e.g.,
#3b82f6) - RGB - RGB function notation (e.g.,
rgb(59, 130, 246)) - HSL - HSL function notation (e.g.,
hsl(217, 91%, 60%)) - OKLCH - OKLCH function notation (e.g.,
oklch(61.5% 0.182 245.7))
src/components/ExportModal.tsx:51-71
Copy to Clipboard
Click the copy button in the top-right of the code preview to copy the generated code. The button shows a check icon for 2 seconds after copying. Source:src/components/ExportModal.tsx:214-222
Tailwind Version Selection
When Tailwind CSS is selected as the export format, a version selector appears to choose between:- v4.2 - Modern
@themedirective syntax - v3.4 - Traditional JavaScript config syntax
src/components/ExportModal.tsx:296-312
Modal Behavior
Opening Animation
The modal uses a two-phase animation:- Modal overlay and content are rendered with opacity 0
- After 10ms, opacity transitions to 1 over 300ms (ease-out)
src/components/ExportModal.tsx:34-42
Closing Animation
When closing:isModalClosingstate is set totrue- Opacity transitions to 0 over 200ms (ease-in)
- After 200ms,
onClosecallback is called - Parent component should set
isOpen={false}in the callback
src/components/ExportModal.tsx:44-49
Click Outside to Close
Click the backdrop or the X button to close the modal. Both trigger the closing animation.State Management
The component uses a reducer to manage internal state:src/components/theme-customizer-types.ts:17-26
Actions include:
OPEN_EXPORT_MODAL/CLOSE_EXPORT_MODALSTART_MODAL_CLOSINGSET_MODAL_ENTERINGSET_EXPORT_FORMATSET_TAILWIND_VERSIONSET_EXPORT_MODESET_COLOR_FORMATSET_COPIED
src/components/theme-customizer-types.ts:28-37
Accessibility
The modal implements proper ARIA attributes:role="dialog"on the containeraria-modal="true"to indicate modal behavioraria-labelledby="modal-title"pointing to the title elementaria-hidden="true"on the backdrop
src/components/ExportModal.tsx:227-232
Interface
src/components/ExportModal.tsx:12-15