create-huenei-template 0.2.14 → 0.2.15
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/dist/config/templates.js +7 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/accessibility-reviewer.md +22 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/nextjs-code-reviewer.md +24 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/react-test-expert.md +32 -0
- package/dist/templates/frontend/react-ssr/.cursor/agents/security-auditor.md +25 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-component.md +97 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-page.md +95 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-prisma-model.md +66 -0
- package/dist/templates/frontend/react-ssr/.cursor/commands/new-server-action.md +89 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/auto-format.ts +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/auto-test-on-stop.ts +94 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/block-dangerous-commands.ts +120 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/ensure-tests-exist.ts +209 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/protect-sensitive-files.ts +101 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/session-context.ts +93 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks/tsconfig.json +10 -0
- package/dist/templates/frontend/react-ssr/.cursor/hooks.json +41 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/auth-patterns.mdc +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/code-quality.mdc +39 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/naming-conventions.mdc +32 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/nextjs-architecture.mdc +51 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/prisma-standards.mdc +53 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/react-conventions.mdc +52 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/testing-conventions.mdc +53 -0
- package/dist/templates/frontend/react-ssr/.cursor/rules/ui-stack.mdc +47 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/authjs-skills/SKILL.md +1149 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/SKILL.md +189 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/daisyUI5.skill +0 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/creating-components.md +412 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/data-display.md +341 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/feedback.md +240 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/input.md +283 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/layout.md +275 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/navigation.md +338 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/daisy-meta.ts +220 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/generate-daisy-safelist.ts +152 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/docker-expert/SKILL.md +413 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/nextjs-app-router-patterns/SKILL.md +537 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/SKILL.md +243 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-execute.md +75 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-pull.md +185 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-push.md +148 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-seed.md +191 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/debug.md +46 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/dev.md +157 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/format.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/generate.md +147 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/init.md +118 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-deploy.md +127 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-dev.md +143 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-diff.md +89 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-reset.md +72 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-resolve.md +57 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-status.md +65 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/studio.md +122 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/validate.md +53 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/SKILL.md +216 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/client-methods.md +221 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/constructor.md +185 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/filters.md +256 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/model-queries.md +281 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/query-options.md +276 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/raw-queries.md +194 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/relations.md +308 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/transactions.md +184 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/AGENTS.md +97 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/README.md +138 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/SKILL.md +116 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/assets/templates/_template.md +26 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/_sections.md +46 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-devtools-performance.md +69 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-formprovider-memo.md +78 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-testing-wrapper.md +63 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-complete-default-objects.md +66 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-separate-crud-operations.md +76 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-unique-fieldarray-per-name.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-use-field-id-as-key.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-virtualization-formprovider.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-avoid-double-registration.md +46 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-controller-field-props.md +56 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-local-state-combination.md +69 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-single-usecontroller-per-component.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-usecontroller-isolation.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-async-default-values.md +69 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-default-values.md +57 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-revalidate-mode.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-should-unregister.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-useeffect-dependency.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-validation-mode.md +51 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-avoid-isvalid-with-onsubmit.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-destructure-formstate.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-getfieldstate-for-single-field.md +49 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-subscribe-to-specific-fields.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-useformstate-isolation.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-mui-controller-pattern.md +59 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-form-import.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-select-wiring.md +64 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-value-transform.md +59 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-avoid-watch-in-render.md +48 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-deep-subscription.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-useformcontext-sparingly.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-default-value.md +50 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-over-watch.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-with-getvalues.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-watch-specific-fields.md +54 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-delay-error.md +52 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-dynamic-schema-factory.md +57 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-error-message-strategy.md +65 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-inline-vs-resolver.md +63 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-native-validation.md +60 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-resolver-caching.md +58 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/SKILL.md +713 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/references/api_reference.md +1121 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/references/best_practices.md +782 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/recharts/references/examples.md +940 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/SKILL.md +114 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-gc-time.md +93 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-invalidation.md +116 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-placeholder-vs-initial.md +156 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-stale-time.md +80 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/err-error-boundaries.md +150 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/inf-page-params.md +132 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-invalidate-queries.md +118 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-mutation-state.md +169 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-optimistic-updates.md +137 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/network-mode.md +179 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/parallel-use-queries.md +152 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/perf-select-transform.md +144 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/persist-queries.md +194 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/pf-intent-prefetch.md +143 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-array-structure.md +50 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-factory-pattern.md +102 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-hierarchical-organization.md +76 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-include-dependencies.md +62 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-serializable.md +93 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/query-cancellation.md +171 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/ssr-dehydration.md +158 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/tanstack-table/SKILL.md +582 -0
- package/dist/templates/frontend/react-ssr/.cursor/skills/zod-4/SKILL.md +216 -0
- package/dist/templates/frontend/react-ssr/.dockerignore +14 -0
- package/dist/templates/frontend/react-ssr/.env.example +9 -0
- package/dist/templates/frontend/react-ssr/.husky/pre-commit +1 -0
- package/dist/templates/frontend/react-ssr/Dockerfile +41 -0
- package/dist/templates/frontend/react-ssr/README.md +121 -0
- package/dist/templates/frontend/react-ssr/components.json +22 -0
- package/dist/templates/frontend/react-ssr/docker-compose.yml +21 -0
- package/dist/templates/frontend/react-ssr/eslint.config.mjs +26 -0
- package/dist/templates/frontend/react-ssr/next.config.ts +7 -0
- package/dist/templates/frontend/react-ssr/package.json +86 -0
- package/dist/templates/frontend/react-ssr/postcss.config.mjs +5 -0
- package/dist/templates/frontend/react-ssr/prisma/schema.prisma +75 -0
- package/dist/templates/frontend/react-ssr/prisma/seed.ts +109 -0
- package/dist/templates/frontend/react-ssr/prisma.config.ts +17 -0
- package/dist/templates/frontend/react-ssr/skills-lock.json +65 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/badge.test.tsx +26 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/button.test.tsx +38 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/card.test.tsx +39 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/components/ui/input.test.tsx +32 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/hooks/useLocalStorage.test.ts +53 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/lib/queryClient.test.ts +19 -0
- package/dist/templates/frontend/react-ssr/src/__tests__/lib/utils.test.ts +24 -0
- package/dist/templates/frontend/react-ssr/src/actions/auth.ts +91 -0
- package/dist/templates/frontend/react-ssr/src/actions/contacto.ts +46 -0
- package/dist/templates/frontend/react-ssr/src/actions/proyectos.ts +159 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/dashboard-client.tsx +321 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/page.tsx +48 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/layout.tsx +34 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/perfil/page.tsx +85 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/page.tsx +23 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/proyectos-crud-client.tsx +472 -0
- package/dist/templates/frontend/react-ssr/src/app/(authenticated)/ui-components/page.tsx +358 -0
- package/dist/templates/frontend/react-ssr/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/dist/templates/frontend/react-ssr/src/app/auth/iniciar-sesion/page.tsx +148 -0
- package/dist/templates/frontend/react-ssr/src/app/auth/recuperar-password/page.tsx +100 -0
- package/dist/templates/frontend/react-ssr/src/app/auth/registro/page.tsx +154 -0
- package/dist/templates/frontend/react-ssr/src/app/contacto/contacto-form.tsx +189 -0
- package/dist/templates/frontend/react-ssr/src/app/contacto/page.tsx +11 -0
- package/dist/templates/frontend/react-ssr/src/app/globals.css +99 -0
- package/dist/templates/frontend/react-ssr/src/app/layout.tsx +22 -0
- package/dist/templates/frontend/react-ssr/src/app/loading.tsx +7 -0
- package/dist/templates/frontend/react-ssr/src/app/not-found.tsx +14 -0
- package/dist/templates/frontend/react-ssr/src/app/page.tsx +331 -0
- package/dist/templates/frontend/react-ssr/src/app/proyectos/page.tsx +178 -0
- package/dist/templates/frontend/react-ssr/src/auth.ts +64 -0
- package/dist/templates/frontend/react-ssr/src/components/layout/navbar.tsx +68 -0
- package/dist/templates/frontend/react-ssr/src/components/layout/sidebar.tsx +109 -0
- package/dist/templates/frontend/react-ssr/src/components/layout/sign-out-button.tsx +16 -0
- package/dist/templates/frontend/react-ssr/src/components/providers.tsx +33 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/avatar.tsx +53 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/badge.tsx +42 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/breadcrumb.tsx +114 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/button.tsx +58 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/card.tsx +95 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/dialog.tsx +136 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/form.tsx +168 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/input.tsx +22 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/label.tsx +26 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/password-input.tsx +43 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/separator.tsx +30 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/table.tsx +240 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/tabs.tsx +76 -0
- package/dist/templates/frontend/react-ssr/src/components/ui/textarea.tsx +21 -0
- package/dist/templates/frontend/react-ssr/src/data/dashboard.ts +179 -0
- package/dist/templates/frontend/react-ssr/src/hooks/useLocalStorage.ts +38 -0
- package/dist/templates/frontend/react-ssr/src/lib/prisma.ts +24 -0
- package/dist/templates/frontend/react-ssr/src/lib/queryClient.ts +25 -0
- package/dist/templates/frontend/react-ssr/src/lib/utils.ts +6 -0
- package/dist/templates/frontend/react-ssr/src/proxy.ts +31 -0
- package/dist/templates/frontend/react-ssr/src/test/mocks/next-navigation.ts +16 -0
- package/dist/templates/frontend/react-ssr/src/test/setup.ts +1 -0
- package/dist/templates/frontend/react-ssr/src/test/utils.tsx +30 -0
- package/dist/templates/frontend/react-ssr/src/types/index.ts +36 -0
- package/dist/templates/frontend/react-ssr/tsconfig.json +41 -0
- package/dist/templates/frontend/react-ssr/vitest.config.ts +41 -0
- package/package.json +1 -1
- package/templates/frontend/react-ssr/.cursor/agents/accessibility-reviewer.md +22 -0
- package/templates/frontend/react-ssr/.cursor/agents/nextjs-code-reviewer.md +24 -0
- package/templates/frontend/react-ssr/.cursor/agents/react-test-expert.md +32 -0
- package/templates/frontend/react-ssr/.cursor/agents/security-auditor.md +25 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-component.md +97 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-page.md +95 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-prisma-model.md +66 -0
- package/templates/frontend/react-ssr/.cursor/commands/new-server-action.md +89 -0
- package/templates/frontend/react-ssr/.cursor/hooks/auto-format.ts +64 -0
- package/templates/frontend/react-ssr/.cursor/hooks/auto-test-on-stop.ts +94 -0
- package/templates/frontend/react-ssr/.cursor/hooks/block-dangerous-commands.ts +120 -0
- package/templates/frontend/react-ssr/.cursor/hooks/ensure-tests-exist.ts +209 -0
- package/templates/frontend/react-ssr/.cursor/hooks/protect-sensitive-files.ts +101 -0
- package/templates/frontend/react-ssr/.cursor/hooks/session-context.ts +93 -0
- package/templates/frontend/react-ssr/.cursor/hooks/tsconfig.json +10 -0
- package/templates/frontend/react-ssr/.cursor/hooks.json +41 -0
- package/templates/frontend/react-ssr/.cursor/rules/auth-patterns.mdc +48 -0
- package/templates/frontend/react-ssr/.cursor/rules/code-quality.mdc +39 -0
- package/templates/frontend/react-ssr/.cursor/rules/naming-conventions.mdc +32 -0
- package/templates/frontend/react-ssr/.cursor/rules/nextjs-architecture.mdc +51 -0
- package/templates/frontend/react-ssr/.cursor/rules/prisma-standards.mdc +53 -0
- package/templates/frontend/react-ssr/.cursor/rules/react-conventions.mdc +52 -0
- package/templates/frontend/react-ssr/.cursor/rules/testing-conventions.mdc +53 -0
- package/templates/frontend/react-ssr/.cursor/rules/ui-stack.mdc +47 -0
- package/templates/frontend/react-ssr/.cursor/skills/authjs-skills/SKILL.md +1149 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/SKILL.md +189 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/daisyUI5.skill +0 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/creating-components.md +412 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/data-display.md +341 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/feedback.md +240 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/input.md +283 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/layout.md +275 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/references/navigation.md +338 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/daisy-meta.ts +220 -0
- package/templates/frontend/react-ssr/.cursor/skills/daisyui-5/scripts/generate-daisy-safelist.ts +152 -0
- package/templates/frontend/react-ssr/.cursor/skills/docker-expert/SKILL.md +413 -0
- package/templates/frontend/react-ssr/.cursor/skills/nextjs-app-router-patterns/SKILL.md +537 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/SKILL.md +243 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-execute.md +75 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-pull.md +185 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-push.md +148 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/db-seed.md +191 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/debug.md +46 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/dev.md +157 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/format.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/generate.md +147 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/init.md +118 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-deploy.md +127 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-dev.md +143 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-diff.md +89 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-reset.md +72 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-resolve.md +57 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/migrate-status.md +65 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/studio.md +122 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-cli/references/validate.md +53 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/SKILL.md +216 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/client-methods.md +221 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/constructor.md +185 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/filters.md +256 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/model-queries.md +281 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/query-options.md +276 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/raw-queries.md +194 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/relations.md +308 -0
- package/templates/frontend/react-ssr/.cursor/skills/prisma-client-api/references/transactions.md +184 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/AGENTS.md +97 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/README.md +138 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/SKILL.md +116 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/assets/templates/_template.md +26 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/_sections.md +46 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-devtools-performance.md +69 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-formprovider-memo.md +78 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/adv-testing-wrapper.md +63 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-complete-default-objects.md +66 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-separate-crud-operations.md +76 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-unique-fieldarray-per-name.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-use-field-id-as-key.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/array-virtualization-formprovider.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-avoid-double-registration.md +46 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-controller-field-props.md +56 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-local-state-combination.md +69 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-single-usecontroller-per-component.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/ctrl-usecontroller-isolation.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-async-default-values.md +69 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-default-values.md +57 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-revalidate-mode.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-should-unregister.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-useeffect-dependency.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formcfg-validation-mode.md +51 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-avoid-isvalid-with-onsubmit.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-destructure-formstate.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-getfieldstate-for-single-field.md +49 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-subscribe-to-specific-fields.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/formstate-useformstate-isolation.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-mui-controller-pattern.md +59 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-form-import.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-shadcn-select-wiring.md +64 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/integ-value-transform.md +59 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-avoid-watch-in-render.md +48 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-deep-subscription.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-useformcontext-sparingly.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-default-value.md +50 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-over-watch.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-usewatch-with-getvalues.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/sub-watch-specific-fields.md +54 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-delay-error.md +52 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-dynamic-schema-factory.md +57 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-error-message-strategy.md +65 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-inline-vs-resolver.md +63 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-native-validation.md +60 -0
- package/templates/frontend/react-ssr/.cursor/skills/react-hook-form/references/valid-resolver-caching.md +58 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/SKILL.md +713 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/references/api_reference.md +1121 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/references/best_practices.md +782 -0
- package/templates/frontend/react-ssr/.cursor/skills/recharts/references/examples.md +940 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/SKILL.md +114 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-gc-time.md +93 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-invalidation.md +116 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-placeholder-vs-initial.md +156 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/cache-stale-time.md +80 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/err-error-boundaries.md +150 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/inf-page-params.md +132 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-invalidate-queries.md +118 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-mutation-state.md +169 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/mut-optimistic-updates.md +137 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/network-mode.md +179 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/parallel-use-queries.md +152 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/perf-select-transform.md +144 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/persist-queries.md +194 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/pf-intent-prefetch.md +143 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-array-structure.md +50 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-factory-pattern.md +102 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-hierarchical-organization.md +76 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-include-dependencies.md +62 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/qk-serializable.md +93 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/query-cancellation.md +171 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-query-best-practices/rules/ssr-dehydration.md +158 -0
- package/templates/frontend/react-ssr/.cursor/skills/tanstack-table/SKILL.md +582 -0
- package/templates/frontend/react-ssr/.cursor/skills/zod-4/SKILL.md +216 -0
- package/templates/frontend/react-ssr/.dockerignore +14 -0
- package/templates/frontend/react-ssr/.env.example +9 -0
- package/templates/frontend/react-ssr/.husky/pre-commit +1 -0
- package/templates/frontend/react-ssr/Dockerfile +41 -0
- package/templates/frontend/react-ssr/README.md +121 -0
- package/templates/frontend/react-ssr/components.json +22 -0
- package/templates/frontend/react-ssr/docker-compose.yml +21 -0
- package/templates/frontend/react-ssr/eslint.config.mjs +26 -0
- package/templates/frontend/react-ssr/next.config.ts +7 -0
- package/templates/frontend/react-ssr/package.json +86 -0
- package/templates/frontend/react-ssr/postcss.config.mjs +5 -0
- package/templates/frontend/react-ssr/prisma/schema.prisma +75 -0
- package/templates/frontend/react-ssr/prisma/seed.ts +109 -0
- package/templates/frontend/react-ssr/prisma.config.ts +17 -0
- package/templates/frontend/react-ssr/skills-lock.json +65 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/badge.test.tsx +26 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/button.test.tsx +38 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/card.test.tsx +39 -0
- package/templates/frontend/react-ssr/src/__tests__/components/ui/input.test.tsx +32 -0
- package/templates/frontend/react-ssr/src/__tests__/hooks/useLocalStorage.test.ts +53 -0
- package/templates/frontend/react-ssr/src/__tests__/lib/queryClient.test.ts +19 -0
- package/templates/frontend/react-ssr/src/__tests__/lib/utils.test.ts +24 -0
- package/templates/frontend/react-ssr/src/actions/auth.ts +91 -0
- package/templates/frontend/react-ssr/src/actions/contacto.ts +46 -0
- package/templates/frontend/react-ssr/src/actions/proyectos.ts +159 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/dashboard-client.tsx +321 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/dashboard/page.tsx +48 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/layout.tsx +34 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/perfil/page.tsx +85 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/page.tsx +23 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/proyectos-crud/proyectos-crud-client.tsx +472 -0
- package/templates/frontend/react-ssr/src/app/(authenticated)/ui-components/page.tsx +358 -0
- package/templates/frontend/react-ssr/src/app/api/auth/[...nextauth]/route.ts +3 -0
- package/templates/frontend/react-ssr/src/app/auth/iniciar-sesion/page.tsx +148 -0
- package/templates/frontend/react-ssr/src/app/auth/recuperar-password/page.tsx +100 -0
- package/templates/frontend/react-ssr/src/app/auth/registro/page.tsx +154 -0
- package/templates/frontend/react-ssr/src/app/contacto/contacto-form.tsx +189 -0
- package/templates/frontend/react-ssr/src/app/contacto/page.tsx +11 -0
- package/templates/frontend/react-ssr/src/app/globals.css +99 -0
- package/templates/frontend/react-ssr/src/app/layout.tsx +22 -0
- package/templates/frontend/react-ssr/src/app/loading.tsx +7 -0
- package/templates/frontend/react-ssr/src/app/not-found.tsx +14 -0
- package/templates/frontend/react-ssr/src/app/page.tsx +331 -0
- package/templates/frontend/react-ssr/src/app/proyectos/page.tsx +178 -0
- package/templates/frontend/react-ssr/src/auth.ts +64 -0
- package/templates/frontend/react-ssr/src/components/layout/navbar.tsx +68 -0
- package/templates/frontend/react-ssr/src/components/layout/sidebar.tsx +109 -0
- package/templates/frontend/react-ssr/src/components/layout/sign-out-button.tsx +16 -0
- package/templates/frontend/react-ssr/src/components/providers.tsx +33 -0
- package/templates/frontend/react-ssr/src/components/ui/avatar.tsx +53 -0
- package/templates/frontend/react-ssr/src/components/ui/badge.tsx +42 -0
- package/templates/frontend/react-ssr/src/components/ui/breadcrumb.tsx +114 -0
- package/templates/frontend/react-ssr/src/components/ui/button.tsx +58 -0
- package/templates/frontend/react-ssr/src/components/ui/card.tsx +95 -0
- package/templates/frontend/react-ssr/src/components/ui/dialog.tsx +136 -0
- package/templates/frontend/react-ssr/src/components/ui/form.tsx +168 -0
- package/templates/frontend/react-ssr/src/components/ui/input.tsx +22 -0
- package/templates/frontend/react-ssr/src/components/ui/label.tsx +26 -0
- package/templates/frontend/react-ssr/src/components/ui/password-input.tsx +43 -0
- package/templates/frontend/react-ssr/src/components/ui/separator.tsx +30 -0
- package/templates/frontend/react-ssr/src/components/ui/table.tsx +240 -0
- package/templates/frontend/react-ssr/src/components/ui/tabs.tsx +76 -0
- package/templates/frontend/react-ssr/src/components/ui/textarea.tsx +21 -0
- package/templates/frontend/react-ssr/src/data/dashboard.ts +179 -0
- package/templates/frontend/react-ssr/src/hooks/useLocalStorage.ts +38 -0
- package/templates/frontend/react-ssr/src/lib/prisma.ts +24 -0
- package/templates/frontend/react-ssr/src/lib/queryClient.ts +25 -0
- package/templates/frontend/react-ssr/src/lib/utils.ts +6 -0
- package/templates/frontend/react-ssr/src/proxy.ts +31 -0
- package/templates/frontend/react-ssr/src/test/mocks/next-navigation.ts +16 -0
- package/templates/frontend/react-ssr/src/test/setup.ts +1 -0
- package/templates/frontend/react-ssr/src/test/utils.tsx +30 -0
- package/templates/frontend/react-ssr/src/types/index.ts +36 -0
- package/templates/frontend/react-ssr/tsconfig.json +41 -0
- package/templates/frontend/react-ssr/vitest.config.ts +41 -0
|
@@ -0,0 +1,713 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: recharts
|
|
3
|
+
description: Build composable, responsive React charts with Recharts library. Use when creating data visualizations including line charts, area charts, bar charts, pie charts, scatter plots, and composed charts. Handles chart customization, responsive sizing, tooltips, legends, axes configuration, performance optimization, and accessibility.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Recharts
|
|
7
|
+
|
|
8
|
+
React charting library built on top of D3 for composable, declarative data visualization.
|
|
9
|
+
|
|
10
|
+
## Quick Start
|
|
11
|
+
|
|
12
|
+
### 1. Install Recharts
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install recharts
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
### 2. Basic Chart Structure
|
|
19
|
+
|
|
20
|
+
All Recharts charts follow the same pattern:
|
|
21
|
+
|
|
22
|
+
```jsx
|
|
23
|
+
import { LineChart, Line, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer } from 'recharts';
|
|
24
|
+
|
|
25
|
+
const data = [
|
|
26
|
+
{ name: 'Jan', sales: 4000, profit: 2400 },
|
|
27
|
+
{ name: 'Feb', sales: 3000, profit: 1398 },
|
|
28
|
+
{ name: 'Mar', sales: 2000, profit: 9800 },
|
|
29
|
+
];
|
|
30
|
+
|
|
31
|
+
<ResponsiveContainer width="100%" height={300}>
|
|
32
|
+
<LineChart data={data}>
|
|
33
|
+
<CartesianGrid strokeDasharray="3 3" />
|
|
34
|
+
<XAxis dataKey="name" />
|
|
35
|
+
<YAxis />
|
|
36
|
+
<Tooltip />
|
|
37
|
+
<Legend />
|
|
38
|
+
<Line type="monotone" dataKey="sales" stroke="#8884d8" />
|
|
39
|
+
<Line type="monotone" dataKey="profit" stroke="#82ca9d" />
|
|
40
|
+
</LineChart>
|
|
41
|
+
</ResponsiveContainer>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Core Concepts
|
|
45
|
+
|
|
46
|
+
### Data Format
|
|
47
|
+
|
|
48
|
+
Recharts expects data as an **array of objects**. Each object represents a data point:
|
|
49
|
+
|
|
50
|
+
```javascript
|
|
51
|
+
const data = [
|
|
52
|
+
{ month: 'Jan', revenue: 4000, expenses: 2400 },
|
|
53
|
+
{ month: 'Feb', revenue: 3000, expenses: 1398 },
|
|
54
|
+
];
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Use `dataKey` props to map object properties to chart components:
|
|
58
|
+
- `dataKey="revenue"` - maps to the revenue property
|
|
59
|
+
- `dataKey={(entry) => entry.revenue - entry.expenses}` - function for computed values
|
|
60
|
+
|
|
61
|
+
### Component Composition
|
|
62
|
+
|
|
63
|
+
Charts are built by nesting specialized components:
|
|
64
|
+
|
|
65
|
+
**Sizing**: Use the `responsive` prop (v3.3+), `ResponsiveContainer` wrapper, or set `width`/`height` directly
|
|
66
|
+
|
|
67
|
+
**Chart types** (choose one):
|
|
68
|
+
- `LineChart` - Line and area visualizations
|
|
69
|
+
- `BarChart` - Bar and column charts
|
|
70
|
+
- `AreaChart` - Stacked and filled area charts
|
|
71
|
+
- `PieChart` - Pie and donut charts
|
|
72
|
+
- `ScatterChart` - Scatter plots and bubble charts
|
|
73
|
+
- `ComposedChart` - Mixed chart types
|
|
74
|
+
- `RadarChart` - Radar/spider charts
|
|
75
|
+
- `RadialBarChart` - Circular bar charts
|
|
76
|
+
|
|
77
|
+
**Common child components**:
|
|
78
|
+
- `XAxis` / `YAxis` - Axis configuration
|
|
79
|
+
- `CartesianGrid` - Grid lines
|
|
80
|
+
- `Tooltip` - Hover information
|
|
81
|
+
- `Legend` - Series identification
|
|
82
|
+
- `Line` / `Bar` / `Area` / `Pie` - Data series visualization
|
|
83
|
+
|
|
84
|
+
## Chart Patterns by Type
|
|
85
|
+
|
|
86
|
+
### Line Charts
|
|
87
|
+
|
|
88
|
+
```jsx
|
|
89
|
+
<LineChart data={data}>
|
|
90
|
+
<XAxis dataKey="name" />
|
|
91
|
+
<YAxis />
|
|
92
|
+
<CartesianGrid strokeDasharray="3 3" />
|
|
93
|
+
<Tooltip />
|
|
94
|
+
<Legend />
|
|
95
|
+
<Line type="monotone" dataKey="value" stroke="#8884d8" strokeWidth={2} dot={{ r: 4 }} />
|
|
96
|
+
</LineChart>
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
**Key props**:
|
|
100
|
+
- `type`: "monotone" (smooth), "linear", "step", "natural"
|
|
101
|
+
- `stroke`: line color
|
|
102
|
+
- `strokeWidth`: line thickness
|
|
103
|
+
- `dot`: point styling (set to `false` to hide)
|
|
104
|
+
- `activeDot`: hovered point styling
|
|
105
|
+
- `connectNulls`: true to connect gaps
|
|
106
|
+
|
|
107
|
+
### Area Charts
|
|
108
|
+
|
|
109
|
+
```jsx
|
|
110
|
+
<AreaChart data={data}>
|
|
111
|
+
<defs>
|
|
112
|
+
<linearGradient id="colorValue" x1="0" y1="0" x2="0" y2="1">
|
|
113
|
+
<stop offset="5%" stopColor="#8884d8" stopOpacity={0.8}/>
|
|
114
|
+
<stop offset="95%" stopColor="#8884d8" stopOpacity={0}/>
|
|
115
|
+
</linearGradient>
|
|
116
|
+
</defs>
|
|
117
|
+
<XAxis dataKey="name" />
|
|
118
|
+
<YAxis />
|
|
119
|
+
<CartesianGrid strokeDasharray="3 3" />
|
|
120
|
+
<Tooltip />
|
|
121
|
+
<Area type="monotone" dataKey="value" stroke="#8884d8" fillOpacity={1} fill="url(#colorValue)" />
|
|
122
|
+
</AreaChart>
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Stacked areas**:
|
|
126
|
+
```jsx
|
|
127
|
+
<Area type="monotone" dataKey="sales" stackId="1" stroke="#8884d8" fill="#8884d8" />
|
|
128
|
+
<Area type="monotone" dataKey="profit" stackId="1" stroke="#82ca9d" fill="#82ca9d" />
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Bar Charts
|
|
132
|
+
|
|
133
|
+
```jsx
|
|
134
|
+
<BarChart data={data}>
|
|
135
|
+
<XAxis dataKey="name" />
|
|
136
|
+
<YAxis />
|
|
137
|
+
<CartesianGrid strokeDasharray="3 3" />
|
|
138
|
+
<Tooltip />
|
|
139
|
+
<Legend />
|
|
140
|
+
<Bar dataKey="sales" fill="#8884d8" radius={[4, 4, 0, 0]} />
|
|
141
|
+
<Bar dataKey="profit" fill="#82ca9d" radius={[4, 4, 0, 0]} />
|
|
142
|
+
</BarChart>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Key props**:
|
|
146
|
+
- `fill`: bar color
|
|
147
|
+
- `radius`: rounded corners [topLeft, topRight, bottomRight, bottomLeft] or single number for all corners
|
|
148
|
+
- `barSize`: fixed bar width
|
|
149
|
+
- `stackId`: group bars into stacks
|
|
150
|
+
- `shape`: custom bar shape (function or element)
|
|
151
|
+
|
|
152
|
+
**Stacked bars**:
|
|
153
|
+
```jsx
|
|
154
|
+
<Bar dataKey="sales" stackId="a" fill="#8884d8" />
|
|
155
|
+
<Bar dataKey="profit" stackId="a" fill="#82ca9d" />
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
**Rounded stacked bars** (use `BarStack` to round the whole stack):
|
|
159
|
+
```jsx
|
|
160
|
+
import { BarStack } from 'recharts';
|
|
161
|
+
|
|
162
|
+
<BarChart data={data}>
|
|
163
|
+
<BarStack stackId="a" radius={[4, 4, 0, 0]}>
|
|
164
|
+
<Bar dataKey="sales" fill="#8884d8" />
|
|
165
|
+
<Bar dataKey="profit" fill="#82ca9d" />
|
|
166
|
+
</BarStack>
|
|
167
|
+
</BarChart>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### Pie Charts
|
|
171
|
+
|
|
172
|
+
```jsx
|
|
173
|
+
const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042'];
|
|
174
|
+
|
|
175
|
+
<PieChart>
|
|
176
|
+
<Pie
|
|
177
|
+
data={data}
|
|
178
|
+
dataKey="value"
|
|
179
|
+
nameKey="name"
|
|
180
|
+
cx="50%"
|
|
181
|
+
cy="50%"
|
|
182
|
+
innerRadius={60}
|
|
183
|
+
outerRadius={80}
|
|
184
|
+
paddingAngle={5}
|
|
185
|
+
shape={(props) => <Sector {...props} fill={COLORS[props.index % COLORS.length]} />}
|
|
186
|
+
/>
|
|
187
|
+
<Tooltip />
|
|
188
|
+
<Legend />
|
|
189
|
+
</PieChart>
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Key props**:
|
|
193
|
+
- `innerRadius`: creates donut chart when > 0
|
|
194
|
+
- `outerRadius`: pie size
|
|
195
|
+
- `paddingAngle`: gap between slices
|
|
196
|
+
- `startAngle` / `endAngle`: partial pie (default: 0 to 360)
|
|
197
|
+
- `label`: shows values on slices
|
|
198
|
+
- `shape`: custom render for each slice (replaces deprecated `Cell` component)
|
|
199
|
+
|
|
200
|
+
### Scatter Charts
|
|
201
|
+
|
|
202
|
+
```jsx
|
|
203
|
+
<ScatterChart>
|
|
204
|
+
<XAxis type="number" dataKey="x" name="X Axis" />
|
|
205
|
+
<YAxis type="number" dataKey="y" name="Y Axis" />
|
|
206
|
+
<CartesianGrid />
|
|
207
|
+
<Tooltip cursor={{ strokeDasharray: '3 3' }} />
|
|
208
|
+
<Scatter name="Series A" data={data} fill="#8884d8" />
|
|
209
|
+
</ScatterChart>
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Composed Charts
|
|
213
|
+
|
|
214
|
+
Mix multiple chart types:
|
|
215
|
+
|
|
216
|
+
```jsx
|
|
217
|
+
<ComposedChart data={data}>
|
|
218
|
+
<XAxis dataKey="name" />
|
|
219
|
+
<YAxis />
|
|
220
|
+
<CartesianGrid stroke="#f5f5f5" />
|
|
221
|
+
<Tooltip />
|
|
222
|
+
<Legend />
|
|
223
|
+
<Area type="monotone" dataKey="total" fill="#8884d8" stroke="#8884d8" />
|
|
224
|
+
<Bar dataKey="sales" barSize={20} fill="#413ea0" />
|
|
225
|
+
<Line type="monotone" dataKey="profit" stroke="#ff7300" />
|
|
226
|
+
</ComposedChart>
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
## Responsive Sizing
|
|
230
|
+
|
|
231
|
+
### Option 1: `responsive` prop (Recharts 3.3+, recommended)
|
|
232
|
+
|
|
233
|
+
Set `responsive` on the chart itself. Uses standard CSS sizing rules:
|
|
234
|
+
|
|
235
|
+
```jsx
|
|
236
|
+
<LineChart data={data} width="100%" height={300} responsive>
|
|
237
|
+
{/* chart components */}
|
|
238
|
+
</LineChart>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Works with flexbox and CSS grid layouts. Also supports CSS `style` props:
|
|
242
|
+
|
|
243
|
+
```jsx
|
|
244
|
+
<LineChart data={data} responsive style={{ maxWidth: 800, width: '100%', aspectRatio: '16/9' }}>
|
|
245
|
+
{/* chart components */}
|
|
246
|
+
</LineChart>
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
### Option 2: `ResponsiveContainer` (older versions)
|
|
250
|
+
|
|
251
|
+
For Recharts < 3.3, wrap chart in `ResponsiveContainer`:
|
|
252
|
+
|
|
253
|
+
```jsx
|
|
254
|
+
<ResponsiveContainer width="100%" height={300}>
|
|
255
|
+
<LineChart data={data}>
|
|
256
|
+
{/* chart components */}
|
|
257
|
+
</LineChart>
|
|
258
|
+
</ResponsiveContainer>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Critical**: `ResponsiveContainer` must have a parent with defined dimensions. Height must be a number, not a percentage.
|
|
262
|
+
|
|
263
|
+
### Static sizing
|
|
264
|
+
|
|
265
|
+
Set `width` and `height` directly as pixels or percentages:
|
|
266
|
+
|
|
267
|
+
```jsx
|
|
268
|
+
<LineChart data={data} width={600} height={300}>
|
|
269
|
+
{/* chart components */}
|
|
270
|
+
</LineChart>
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Axes Configuration
|
|
274
|
+
|
|
275
|
+
### XAxis / YAxis Props
|
|
276
|
+
|
|
277
|
+
```jsx
|
|
278
|
+
<XAxis
|
|
279
|
+
dataKey="name" // property to display
|
|
280
|
+
type="category" // "category" or "number"
|
|
281
|
+
domain={[0, 'dataMax']} // axis range
|
|
282
|
+
tick={{ fill: '#666' }} // tick styling
|
|
283
|
+
tickFormatter={(value) => `$${value}`} // format labels
|
|
284
|
+
angle={-45} // rotate labels
|
|
285
|
+
textAnchor="end" // text alignment
|
|
286
|
+
height={60} // extra space for labels
|
|
287
|
+
/>
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
### Axis Types
|
|
291
|
+
|
|
292
|
+
- **Category axis** (default for X): Treats values as discrete labels
|
|
293
|
+
- **Number axis** (default for Y): Treats values as continuous scale
|
|
294
|
+
|
|
295
|
+
### Custom Domains
|
|
296
|
+
|
|
297
|
+
Control axis range:
|
|
298
|
+
|
|
299
|
+
```jsx
|
|
300
|
+
// Fixed range
|
|
301
|
+
<YAxis domain={[0, 100]} />
|
|
302
|
+
|
|
303
|
+
// Auto with padding
|
|
304
|
+
<YAxis domain={[0, 'auto']} />
|
|
305
|
+
|
|
306
|
+
// Data-based with overflow allowed
|
|
307
|
+
<YAxis domain={[0, 'dataMax + 100']} allowDataOverflow />
|
|
308
|
+
|
|
309
|
+
// Logarithmic scale
|
|
310
|
+
<YAxis type="number" scale="log" domain={['auto', 'auto']} />
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Customization
|
|
314
|
+
|
|
315
|
+
### Custom Tooltip
|
|
316
|
+
|
|
317
|
+
```jsx
|
|
318
|
+
const CustomTooltip = ({ active, payload, label }) => {
|
|
319
|
+
if (active && payload && payload.length) {
|
|
320
|
+
return (
|
|
321
|
+
<div className="custom-tooltip">
|
|
322
|
+
<p className="label">{`${label}`}</p>
|
|
323
|
+
<p className="intro">{`Sales: ${payload[0].value}`}</p>
|
|
324
|
+
<p className="desc">Additional info...</p>
|
|
325
|
+
</div>
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
return null;
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
<Tooltip content={<CustomTooltip />} />
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
### Custom Legend
|
|
335
|
+
|
|
336
|
+
```jsx
|
|
337
|
+
const CustomLegend = ({ payload }) => (
|
|
338
|
+
<ul>
|
|
339
|
+
{payload.map((entry, index) => (
|
|
340
|
+
<li key={`item-${index}`} style={{ color: entry.color }}>
|
|
341
|
+
{entry.value}
|
|
342
|
+
</li>
|
|
343
|
+
))}
|
|
344
|
+
</ul>
|
|
345
|
+
);
|
|
346
|
+
|
|
347
|
+
<Legend content={<CustomLegend />} />
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
### Custom Shapes
|
|
351
|
+
|
|
352
|
+
**Custom bar shape**:
|
|
353
|
+
```jsx
|
|
354
|
+
const CustomBar = (props) => {
|
|
355
|
+
const { x, y, width, height, fill } = props;
|
|
356
|
+
return <path d={`M${x},${y} ...`} fill={fill} />;
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
<Bar shape={<CustomBar />} dataKey="sales" />
|
|
360
|
+
// OR
|
|
361
|
+
<Bar shape={(props) => <CustomBar {...props} />} dataKey="sales" />
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
### Custom Labels
|
|
365
|
+
|
|
366
|
+
```jsx
|
|
367
|
+
<Line
|
|
368
|
+
dataKey="sales"
|
|
369
|
+
label={{ position: 'top', fill: '#666', fontSize: 12 }}
|
|
370
|
+
/>
|
|
371
|
+
|
|
372
|
+
// Custom label component
|
|
373
|
+
<Line
|
|
374
|
+
dataKey="sales"
|
|
375
|
+
label={<CustomLabel />}
|
|
376
|
+
/>
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
### Styling
|
|
380
|
+
|
|
381
|
+
**Chart styles**:
|
|
382
|
+
```jsx
|
|
383
|
+
<LineChart style={{ backgroundColor: '#f5f5f5' }}>
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
**Axis styling**:
|
|
387
|
+
```jsx
|
|
388
|
+
<XAxis
|
|
389
|
+
axisLine={{ stroke: '#666' }}
|
|
390
|
+
tickLine={{ stroke: '#666' }}
|
|
391
|
+
tick={{ fill: '#666', fontSize: 12 }}
|
|
392
|
+
/>
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
**Grid styling**:
|
|
396
|
+
```jsx
|
|
397
|
+
<CartesianGrid strokeDasharray="3 3" stroke="#e0e0e0" />
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
## Interactions
|
|
401
|
+
|
|
402
|
+
### Active Elements and Interaction Control
|
|
403
|
+
|
|
404
|
+
The `Tooltip` component controls active element highlighting. Do not use `activeIndex` prop (removed in v3).
|
|
405
|
+
|
|
406
|
+
**Tooltip interaction props**:
|
|
407
|
+
- `defaultIndex`: Sets initial highlighted item on render
|
|
408
|
+
- `active`: If true, tooltip remains active after interaction ends
|
|
409
|
+
- `trigger`: `"hover"` (default) or `"click"` for click-based interaction
|
|
410
|
+
- `content`: Custom content or `() => null` to hide tooltip text while keeping highlight
|
|
411
|
+
- `cursor`: Visual cursor in plot area, set to `false` to hide
|
|
412
|
+
|
|
413
|
+
```jsx
|
|
414
|
+
{/* Click-based interaction with hidden tooltip text */}
|
|
415
|
+
<Tooltip trigger="click" content={() => null} cursor={false} />
|
|
416
|
+
|
|
417
|
+
{/* Default highlighted item on render */}
|
|
418
|
+
<Tooltip defaultIndex={2} />
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
### Click Events
|
|
422
|
+
|
|
423
|
+
```jsx
|
|
424
|
+
<LineChart onClick={(e) => console.log(e)}>
|
|
425
|
+
<Bar
|
|
426
|
+
dataKey="sales"
|
|
427
|
+
onClick={(data, index) => console.log('Bar clicked:', data)}
|
|
428
|
+
/>
|
|
429
|
+
</LineChart>
|
|
430
|
+
```
|
|
431
|
+
|
|
432
|
+
### Synchronized Charts
|
|
433
|
+
|
|
434
|
+
Link multiple charts with `syncId`:
|
|
435
|
+
|
|
436
|
+
```jsx
|
|
437
|
+
<LineChart data={data1} syncId="anyId">
|
|
438
|
+
{/* components */}
|
|
439
|
+
</LineChart>
|
|
440
|
+
|
|
441
|
+
<LineChart data={data2} syncId="anyId">
|
|
442
|
+
{/* components - tooltips synchronize */}
|
|
443
|
+
</LineChart>
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### Brush for Zooming
|
|
447
|
+
|
|
448
|
+
```jsx
|
|
449
|
+
<LineChart data={data}>
|
|
450
|
+
{/* other components */}
|
|
451
|
+
<Brush dataKey="name" height={30} stroke="#8884d8" />
|
|
452
|
+
</LineChart>
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
## Performance Optimization
|
|
456
|
+
|
|
457
|
+
### 1. Stable References
|
|
458
|
+
|
|
459
|
+
Use `useMemo` and `useCallback` for props:
|
|
460
|
+
|
|
461
|
+
```jsx
|
|
462
|
+
// BAD - new function on every render
|
|
463
|
+
<Line dataKey={(entry) => entry.sales * 2} />
|
|
464
|
+
|
|
465
|
+
// GOOD - stable reference
|
|
466
|
+
const dataKey = useCallback((entry) => entry.sales * 2, []);
|
|
467
|
+
<Line dataKey={dataKey} />
|
|
468
|
+
```
|
|
469
|
+
|
|
470
|
+
### 2. Memoize Components
|
|
471
|
+
|
|
472
|
+
```jsx
|
|
473
|
+
const MemoizedChart = React.memo(({ data }) => (
|
|
474
|
+
<LineChart data={data}>
|
|
475
|
+
{/* components */}
|
|
476
|
+
</LineChart>
|
|
477
|
+
));
|
|
478
|
+
```
|
|
479
|
+
|
|
480
|
+
### 3. Isolate Changing Components
|
|
481
|
+
|
|
482
|
+
Separate frequently updating components:
|
|
483
|
+
|
|
484
|
+
```jsx
|
|
485
|
+
const Chart = () => {
|
|
486
|
+
const [hoveredData, setHoveredData] = useState(null);
|
|
487
|
+
|
|
488
|
+
return (
|
|
489
|
+
<LineChart>
|
|
490
|
+
{/* Static components */}
|
|
491
|
+
<Line dataKey="sales" />
|
|
492
|
+
|
|
493
|
+
{/* Dynamic overlay */}
|
|
494
|
+
<ReferenceLine x={hoveredData?.x} stroke="red" />
|
|
495
|
+
</LineChart>
|
|
496
|
+
);
|
|
497
|
+
};
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
### 4. Debounce Events
|
|
501
|
+
|
|
502
|
+
```jsx
|
|
503
|
+
import { useDebouncedCallback } from 'use-debounce';
|
|
504
|
+
|
|
505
|
+
const handleMouseMove = useDebouncedCallback((e) => {
|
|
506
|
+
setPosition(e.activeLabel);
|
|
507
|
+
}, 10);
|
|
508
|
+
|
|
509
|
+
<LineChart onMouseMove={handleMouseMove}>
|
|
510
|
+
```
|
|
511
|
+
|
|
512
|
+
### 5. Reduce Data Points
|
|
513
|
+
|
|
514
|
+
For large datasets, consider aggregation:
|
|
515
|
+
|
|
516
|
+
```jsx
|
|
517
|
+
// Bin data before rendering
|
|
518
|
+
const binnedData = useMemo(() => {
|
|
519
|
+
return d3.bin().value(d => d.x)(rawData);
|
|
520
|
+
}, [rawData]);
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
## Accessibility
|
|
524
|
+
|
|
525
|
+
Recharts includes built-in accessibility support:
|
|
526
|
+
|
|
527
|
+
```jsx
|
|
528
|
+
<LineChart accessibilityLayer={true}>
|
|
529
|
+
<Line dataKey="sales" name="Monthly Sales" />
|
|
530
|
+
</LineChart>
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
**Accessibility is enabled by default**. The chart is keyboard navigable and screen reader compatible.
|
|
534
|
+
|
|
535
|
+
**ARIA props**:
|
|
536
|
+
```jsx
|
|
537
|
+
<LineChart role="img" aria-label="Sales chart showing monthly revenue">
|
|
538
|
+
```
|
|
539
|
+
|
|
540
|
+
## Common Patterns
|
|
541
|
+
|
|
542
|
+
### Multiple Data Series
|
|
543
|
+
|
|
544
|
+
```jsx
|
|
545
|
+
<LineChart data={data}>
|
|
546
|
+
<XAxis dataKey="month" />
|
|
547
|
+
<YAxis />
|
|
548
|
+
<Tooltip />
|
|
549
|
+
<Legend />
|
|
550
|
+
<Line type="monotone" dataKey="productA" name="Product A" stroke="#8884d8" />
|
|
551
|
+
<Line type="monotone" dataKey="productB" name="Product B" stroke="#82ca9d" />
|
|
552
|
+
<Line type="monotone" dataKey="productC" name="Product C" stroke="#ffc658" />
|
|
553
|
+
</LineChart>
|
|
554
|
+
```
|
|
555
|
+
|
|
556
|
+
### Horizontal Bar Chart
|
|
557
|
+
|
|
558
|
+
```jsx
|
|
559
|
+
<BarChart layout="vertical" data={data}>
|
|
560
|
+
<XAxis type="number" />
|
|
561
|
+
<YAxis type="category" dataKey="name" />
|
|
562
|
+
<Bar dataKey="value" />
|
|
563
|
+
</BarChart>
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Donut Chart
|
|
567
|
+
|
|
568
|
+
```jsx
|
|
569
|
+
const COLORS = ['#0088FE', '#00C49F', '#FFBB28', '#FF8042'];
|
|
570
|
+
|
|
571
|
+
<PieChart>
|
|
572
|
+
<Pie
|
|
573
|
+
data={data}
|
|
574
|
+
innerRadius={60}
|
|
575
|
+
outerRadius={80}
|
|
576
|
+
paddingAngle={5}
|
|
577
|
+
dataKey="value"
|
|
578
|
+
shape={(props) => <Sector {...props} fill={COLORS[props.index % COLORS.length]} />}
|
|
579
|
+
/>
|
|
580
|
+
</PieChart>
|
|
581
|
+
```
|
|
582
|
+
|
|
583
|
+
> **Note**: `Cell` component is deprecated and will be removed in Recharts 4.0. Use the `shape` prop on `Bar`, `Pie`, `Scatter`, etc. instead.
|
|
584
|
+
|
|
585
|
+
### Reference Lines/Areas
|
|
586
|
+
|
|
587
|
+
```jsx
|
|
588
|
+
<LineChart data={data}>
|
|
589
|
+
{/* ... */}
|
|
590
|
+
<ReferenceLine y={5000} label="Target" stroke="red" strokeDasharray="3 3" />
|
|
591
|
+
<ReferenceArea x1="Jan" x2="Mar" fill="#8884d8" fillOpacity={0.1} />
|
|
592
|
+
</LineChart>
|
|
593
|
+
```
|
|
594
|
+
|
|
595
|
+
### Error Bars
|
|
596
|
+
|
|
597
|
+
```jsx
|
|
598
|
+
<ScatterChart>
|
|
599
|
+
<Scatter data={data}>
|
|
600
|
+
<ErrorBar dataKey="errorX" width={4} strokeWidth={2} />
|
|
601
|
+
<ErrorBar dataKey="errorY" width={4} strokeWidth={2} direction="y" />
|
|
602
|
+
</Scatter>
|
|
603
|
+
</ScatterChart>
|
|
604
|
+
```
|
|
605
|
+
|
|
606
|
+
## Integration Patterns
|
|
607
|
+
|
|
608
|
+
### With State Management
|
|
609
|
+
|
|
610
|
+
```jsx
|
|
611
|
+
const SalesChart = () => {
|
|
612
|
+
const [timeRange, setTimeRange] = useState('month');
|
|
613
|
+
const data = useSelector(state => selectSalesData(state, timeRange));
|
|
614
|
+
|
|
615
|
+
return (
|
|
616
|
+
<ResponsiveContainer>
|
|
617
|
+
<LineChart data={data}>
|
|
618
|
+
{/* components */}
|
|
619
|
+
</LineChart>
|
|
620
|
+
</ResponsiveContainer>
|
|
621
|
+
);
|
|
622
|
+
};
|
|
623
|
+
```
|
|
624
|
+
|
|
625
|
+
### With Real-time Data
|
|
626
|
+
|
|
627
|
+
```jsx
|
|
628
|
+
const RealtimeChart = () => {
|
|
629
|
+
const [data, setData] = useState([]);
|
|
630
|
+
|
|
631
|
+
useEffect(() => {
|
|
632
|
+
const interval = setInterval(() => {
|
|
633
|
+
setData(prev => [...prev.slice(-20), newDataPoint]);
|
|
634
|
+
}, 1000);
|
|
635
|
+
return () => clearInterval(interval);
|
|
636
|
+
}, []);
|
|
637
|
+
|
|
638
|
+
return (
|
|
639
|
+
<LineChart data={data}>
|
|
640
|
+
<XAxis dataKey="time" />
|
|
641
|
+
<YAxis domain={['auto', 'auto']} />
|
|
642
|
+
<Line type="monotone" dataKey="value" isAnimationActive={false} />
|
|
643
|
+
</LineChart>
|
|
644
|
+
);
|
|
645
|
+
};
|
|
646
|
+
```
|
|
647
|
+
|
|
648
|
+
## Z-Index and Layering (v3.4+)
|
|
649
|
+
|
|
650
|
+
Components render in a default order (grid < axes < chart elements < tooltip/legend). Override with `zIndex` prop:
|
|
651
|
+
|
|
652
|
+
```jsx
|
|
653
|
+
<Line dataKey="sales" zIndex={10} /> // Render on top
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
For components without direct `zIndex` support, wrap in `ZIndexLayer`:
|
|
657
|
+
|
|
658
|
+
```jsx
|
|
659
|
+
import { ZIndexLayer } from 'recharts';
|
|
660
|
+
|
|
661
|
+
<ZIndexLayer zIndex={5}>
|
|
662
|
+
<CustomAnnotation />
|
|
663
|
+
</ZIndexLayer>
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
## Coordinate Systems
|
|
667
|
+
|
|
668
|
+
Recharts has three coordinate systems:
|
|
669
|
+
|
|
670
|
+
1. **Domain coordinates** - Data values (e.g., `x="March"`, `y=5000`). Used by `ReferenceLine`, `ReferenceDot`, `ReferenceArea`. Automatically converted to pixels.
|
|
671
|
+
2. **Pixel coordinates** - Positions relative to chart viewBox. Used for custom SVG shapes. Access via `usePlotArea()`, `useOffset()`, `useChartWidth()` hooks.
|
|
672
|
+
3. **Mouse event coordinates** - Browser viewport coordinates. Convert with `getRelativeCoordinate(event, element)`.
|
|
673
|
+
|
|
674
|
+
**Converting between systems**:
|
|
675
|
+
- Data to pixels: `useXAxisScale()`, `useYAxisScale()`
|
|
676
|
+
- Pixels to data: `useXAxisInverseScale()`, `useYAxisInverseScale()`
|
|
677
|
+
|
|
678
|
+
## Troubleshooting
|
|
679
|
+
|
|
680
|
+
### Chart Not Rendering
|
|
681
|
+
|
|
682
|
+
- Ensure `ResponsiveContainer` has a parent with defined dimensions
|
|
683
|
+
- Check that height is a number (not percentage in ResponsiveContainer)
|
|
684
|
+
- Verify data is an array of objects
|
|
685
|
+
|
|
686
|
+
### Tooltip Not Showing
|
|
687
|
+
|
|
688
|
+
- Ensure Tooltip component is included
|
|
689
|
+
- Check that dataKey values exist in data objects
|
|
690
|
+
|
|
691
|
+
### Axis Labels Overlapping
|
|
692
|
+
|
|
693
|
+
- Rotate labels: `<XAxis angle={-45} textAnchor="end" height={80} />`
|
|
694
|
+
- Use interval: `<XAxis interval={0} />` (0 = show all, 'preserveStartEnd' = auto)
|
|
695
|
+
|
|
696
|
+
### Animation Issues
|
|
697
|
+
|
|
698
|
+
- Disable: `<Line isAnimationActive={false} />`
|
|
699
|
+
- Reduce duration: `<Line animationDuration={500} />`
|
|
700
|
+
|
|
701
|
+
## Resources
|
|
702
|
+
|
|
703
|
+
### References
|
|
704
|
+
|
|
705
|
+
- **[API Reference](references/api_reference.md)** - Complete component props and API details
|
|
706
|
+
- **[Examples](references/examples.md)** - Common chart patterns and code snippets
|
|
707
|
+
- **[Best Practices](references/best_practices.md)** - Performance and design guidelines
|
|
708
|
+
|
|
709
|
+
### External Resources
|
|
710
|
+
|
|
711
|
+
- [Official Documentation](https://recharts.github.io/en-US/)
|
|
712
|
+
- [Storybook](https://recharts.github.io/en-US/storybook/)
|
|
713
|
+
- [GitHub](https://github.com/recharts/recharts)
|