skillfullstack 0.0.0-stage → 1.0.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/.skillsRegistry/catalog.json +231 -0
- package/AGENTS.md +89 -0
- package/README.md +210 -2
- package/bin/index.js +508 -0
- package/package.json +57 -4
- package/skills/backend/apiEngineering/SKILL.md +102 -0
- package/skills/backend/apiEngineering/evals/evalApiEngineering.py +81 -0
- package/skills/backend/apiEngineering/evals/fixtures/invalid/sampleInvalidOpenApi.json +40 -0
- package/skills/backend/apiEngineering/evals/fixtures/valid/sampleValidOpenApi.json +47 -0
- package/skills/backend/apiEngineering/policies/compatibility.md +42 -0
- package/skills/backend/apiEngineering/policies/mandatory.md +48 -0
- package/skills/backend/apiEngineering/policies/performance.md +39 -0
- package/skills/backend/apiEngineering/policies/security.md +36 -0
- package/skills/backend/apiEngineering/references/apiObservability.md +39 -0
- package/skills/backend/apiEngineering/references/apiReference.md +3 -0
- package/skills/backend/apiEngineering/references/apiSecurityOwasp.md +47 -0
- package/skills/backend/apiEngineering/references/contractCompatibility.md +26 -0
- package/skills/backend/apiEngineering/references/databaseTransactions.md +40 -0
- package/skills/backend/apiEngineering/references/distributedReliability.md +26 -0
- package/skills/backend/apiEngineering/references/multiTenancy.md +27 -0
- package/skills/backend/apiEngineering/references/openApi32Standards.md +58 -0
- package/skills/backend/apiEngineering/references/paginationVersioning.md +57 -0
- package/skills/backend/apiEngineering/references/responseStandards.md +94 -0
- package/skills/backend/apiEngineering/scripts/auditApiContract.py +123 -0
- package/skills/backend/apiEngineering/scripts/checkBreakingChanges.py +77 -0
- package/skills/backend/apiEngineering/scripts/generateResponseEnvelope.py +88 -0
- package/skills/backend/apiEngineering/templates/apiChecklist.md +27 -0
- package/skills/backend/apiEngineering/templates/openapi.yaml +125 -0
- package/skills/backend/apiEngineering/templates/problemDetails.json +44 -0
- package/skills/backend/databaseArchitecture/SKILL.md +118 -0
- package/skills/backend/databaseArchitecture/evals/evalDatabaseArchitecture.py +85 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/dangerousMigration.sql +4 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/invalidSchema.sql +23 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/safeMigration.sql +3 -0
- package/skills/backend/databaseArchitecture/evals/fixtures/validSchema.sql +37 -0
- package/skills/backend/databaseArchitecture/policies/integrity.md +25 -0
- package/skills/backend/databaseArchitecture/policies/mandatory.md +32 -0
- package/skills/backend/databaseArchitecture/policies/migration.md +22 -0
- package/skills/backend/databaseArchitecture/policies/normalization.md +25 -0
- package/skills/backend/databaseArchitecture/policies/performance.md +26 -0
- package/skills/backend/databaseArchitecture/policies/recovery.md +23 -0
- package/skills/backend/databaseArchitecture/policies/security.md +26 -0
- package/skills/backend/databaseArchitecture/policies/tableCreationChecklist.md +70 -0
- package/skills/backend/databaseArchitecture/references/analyticsWarehousing.md +32 -0
- package/skills/backend/databaseArchitecture/references/apiReference.md +3 -0
- package/skills/backend/databaseArchitecture/references/backupDisasterRecovery.md +27 -0
- package/skills/backend/databaseArchitecture/references/dataModelingLifecycle.md +30 -0
- package/skills/backend/databaseArchitecture/references/databaseTaxonomy.md +32 -0
- package/skills/backend/databaseArchitecture/references/indexingOptimization.md +32 -0
- package/skills/backend/databaseArchitecture/references/normalizationTheory.md +61 -0
- package/skills/backend/databaseArchitecture/references/scalabilitySharding.md +37 -0
- package/skills/backend/databaseArchitecture/references/transactionConcurrency.md +39 -0
- package/skills/backend/databaseArchitecture/scripts/analyzeMigration.py +99 -0
- package/skills/backend/databaseArchitecture/scripts/auditDatabaseSchema.py +177 -0
- package/skills/backend/databaseArchitecture/scripts/inspectDatabaseIndexes.py +149 -0
- package/skills/backend/databaseArchitecture/templates/adrTemplate.md +32 -0
- package/skills/backend/databaseArchitecture/templates/databaseChecklist.md +29 -0
- package/skills/backend/databaseArchitecture/templates/migrationPlan.md +40 -0
- package/skills/backend/durableBackgroundJobs/SKILL.md +112 -0
- package/skills/backend/durableBackgroundJobs/evals/durableJobVerification.json +14 -0
- package/skills/backend/durableBackgroundJobs/references/apiReference.md +3 -0
- package/skills/backend/durableBackgroundJobs/references/durableStepPatterns.md +6 -0
- package/skills/backend/durableBackgroundJobs/references/idempotencyKeys.md +5 -0
- package/skills/backend/durableBackgroundJobs/scripts/testWorkflowDispatch.py +24 -0
- package/skills/backend/golangStandard/SKILL.md +155 -0
- package/skills/backend/golangStandard/evals/goVerification.json +14 -0
- package/skills/backend/golangStandard/references/apiReference.md +3 -0
- package/skills/backend/golangStandard/references/layoutGuide.md +26 -0
- package/skills/backend/golangStandard/references/slogPatterns.md +26 -0
- package/skills/backend/golangStandard/scripts/scaffoldGoModule.py +105 -0
- package/skills/backend/pythonStandard/SKILL.md +138 -0
- package/skills/backend/pythonStandard/evals/pythonVerification.json +14 -0
- package/skills/backend/pythonStandard/references/apiReference.md +3 -0
- package/skills/backend/pythonStandard/references/pydanticPatterns.md +16 -0
- package/skills/backend/pythonStandard/references/pyprojectSpecs.md +37 -0
- package/skills/backend/pythonStandard/scripts/scaffoldUvProject.py +79 -0
- package/skills/backend/upstash/SKILL.md +98 -0
- package/skills/backend/upstash/evals/upstashVerification.json +14 -0
- package/skills/backend/upstash/references/apiReference.md +3 -0
- package/skills/backend/upstash/references/qstashFlowControl.md +34 -0
- package/skills/backend/upstash/references/ratelimitPatterns.md +53 -0
- package/skills/backend/upstash/references/workflowPatterns.md +35 -0
- package/skills/backend/upstash/scripts/testRedisConnection.py +36 -0
- package/skills/cicdDevops/cicdPipeline/SKILL.md +148 -0
- package/skills/cicdDevops/cicdPipeline/evals/evalCicd.py +37 -0
- package/skills/cicdDevops/cicdPipeline/references/apiReference.md +3 -0
- package/skills/cicdDevops/cicdPipeline/references/cicdDeploymentPatterns.md +27 -0
- package/skills/cicdDevops/cicdPipeline/scripts/auditDockerfileSecurity.py +56 -0
- package/skills/dataAi/mcpServerDevelopment/SKILL.md +123 -0
- package/skills/dataAi/mcpServerDevelopment/evals/mcpVerification.json +14 -0
- package/skills/dataAi/mcpServerDevelopment/references/apiReference.md +3 -0
- package/skills/dataAi/mcpServerDevelopment/references/mcpClientConfigs.md +38 -0
- package/skills/dataAi/mcpServerDevelopment/references/toolSchemaDesign.md +6 -0
- package/skills/dataAi/mcpServerDevelopment/scripts/runFastMcpBoilerplate.py +36 -0
- package/skills/dataAi/ragPipelineProduction/SKILL.md +113 -0
- package/skills/dataAi/ragPipelineProduction/evals/ragVerification.json +14 -0
- package/skills/dataAi/ragPipelineProduction/references/apiReference.md +3 -0
- package/skills/dataAi/ragPipelineProduction/references/chunkingStrategies.md +10 -0
- package/skills/dataAi/ragPipelineProduction/references/rrfAlgorithm.md +13 -0
- package/skills/dataAi/ragPipelineProduction/scripts/runHybridRrfSearch.py +33 -0
- package/skills/devopsCloud/cloudflare/SKILL.md +282 -0
- package/skills/devopsCloud/cloudflare/assets/README.md +48 -0
- package/skills/devopsCloud/cloudflare/assets/ai/agents-sdk.md +118 -0
- package/skills/devopsCloud/cloudflare/assets/ai/ai-gateway.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/ai/ai-search.md +129 -0
- package/skills/devopsCloud/cloudflare/assets/ai/workers-ai.md +127 -0
- package/skills/devopsCloud/cloudflare/assets/cli/c3.md +292 -0
- package/skills/devopsCloud/cloudflare/assets/cli/cf-cli.md +90 -0
- package/skills/devopsCloud/cloudflare/assets/cli/wrangler.md +43 -0
- package/skills/devopsCloud/cloudflare/assets/compute/cron-triggers.md +486 -0
- package/skills/devopsCloud/cloudflare/assets/compute/service-bindings.md +251 -0
- package/skills/devopsCloud/cloudflare/assets/compute/smart-placement.md +435 -0
- package/skills/devopsCloud/cloudflare/assets/compute/static-assets.md +220 -0
- package/skills/devopsCloud/cloudflare/assets/compute/workers.md +129 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/d1.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/durable-objects.md +122 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/hyperdrive.md +210 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/kv.md +198 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/queues.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/r2.md +105 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/vectorize.md +97 -0
- package/skills/devopsCloud/cloudflare/assets/database-storage/workflows.md +141 -0
- package/skills/devopsCloud/cloudflare/assets/llms.txt +143 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/cache-cdn.md +109 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/dns.md +71 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/rate-limiting.md +130 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/tunnels.md +57 -0
- package/skills/devopsCloud/cloudflare/assets/networking-security/waf.md +143 -0
- package/skills/devopsCloud/cloudflare/assets/troubleshooting/1xxx-errors.md +209 -0
- package/skills/devopsCloud/cloudflare/assets/troubleshooting/5xx-errors.md +111 -0
- package/skills/devopsCloud/cloudflare/assets/troubleshooting/http-status-codes.md +38 -0
- package/skills/devopsCloud/cloudflare/evals/evals.json +75 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/README.md +27 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/dynamic-routing.md +15 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/features.md +22 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/sdk-integration.md +19 -0
- package/skills/devopsCloud/cloudflare/references/ai-gateway/troubleshooting.md +16 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/README.md +25 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/gotchas.md +13 -0
- package/skills/devopsCloud/cloudflare/references/ai-search/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/bindings/README.md +16 -0
- package/skills/devopsCloud/cloudflare/references/bindings/api.md +19 -0
- package/skills/devopsCloud/cloudflare/references/bindings/configuration.md +20 -0
- package/skills/devopsCloud/cloudflare/references/bindings/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/bindings/patterns.md +20 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/README.md +18 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/api.md +12 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/configuration.md +12 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/browser-rendering/patterns.md +12 -0
- package/skills/devopsCloud/cloudflare/references/cliComparison.md +93 -0
- package/skills/devopsCloud/cloudflare/references/containers/README.md +23 -0
- package/skills/devopsCloud/cloudflare/references/containers/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/containers/configuration.md +15 -0
- package/skills/devopsCloud/cloudflare/references/containers/gotchas.md +16 -0
- package/skills/devopsCloud/cloudflare/references/containers/patterns.md +18 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/cron-triggers/patterns.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/README.md +15 -0
- package/skills/devopsCloud/cloudflare/references/d1/api.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/d1/patterns.md +21 -0
- package/skills/devopsCloud/cloudflare/references/frameworkCompatibility.md +110 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/README.md +28 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/api.md +26 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/configuration.md +34 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/gotchas.md +20 -0
- package/skills/devopsCloud/cloudflare/references/hyperdrive/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/images/README.md +12 -0
- package/skills/devopsCloud/cloudflare/references/images/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/images/configuration.md +17 -0
- package/skills/devopsCloud/cloudflare/references/images/gotchas.md +16 -0
- package/skills/devopsCloud/cloudflare/references/images/patterns.md +16 -0
- package/skills/devopsCloud/cloudflare/references/kv/README.md +15 -0
- package/skills/devopsCloud/cloudflare/references/kv/api.md +18 -0
- package/skills/devopsCloud/cloudflare/references/kv/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/kv/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/kv/patterns.md +21 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/miniflare/patterns.md +19 -0
- package/skills/devopsCloud/cloudflare/references/observability/README.md +27 -0
- package/skills/devopsCloud/cloudflare/references/observability/api.md +20 -0
- package/skills/devopsCloud/cloudflare/references/observability/configuration.md +23 -0
- package/skills/devopsCloud/cloudflare/references/observability/gotchas.md +25 -0
- package/skills/devopsCloud/cloudflare/references/observability/patterns.md +14 -0
- package/skills/devopsCloud/cloudflare/references/pages/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/pages/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/pages/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/pages/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/pages/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/configuration.md +14 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/pages-functions/patterns.md +16 -0
- package/skills/devopsCloud/cloudflare/references/productSelectionMatrix.md +54 -0
- package/skills/devopsCloud/cloudflare/references/queues/README.md +24 -0
- package/skills/devopsCloud/cloudflare/references/queues/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/queues/configuration.md +20 -0
- package/skills/devopsCloud/cloudflare/references/queues/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/queues/patterns.md +21 -0
- package/skills/devopsCloud/cloudflare/references/r2/README.md +26 -0
- package/skills/devopsCloud/cloudflare/references/r2/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/r2/configuration.md +19 -0
- package/skills/devopsCloud/cloudflare/references/r2/gotchas.md +17 -0
- package/skills/devopsCloud/cloudflare/references/r2/patterns.md +18 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/api.md +21 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/configuration.md +25 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/secrets-store/patterns.md +27 -0
- package/skills/devopsCloud/cloudflare/references/skill-feedback.md +41 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/README.md +21 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/api.md +16 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/static-assets/patterns.md +17 -0
- package/skills/devopsCloud/cloudflare/references/stream/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/stream/api-live.md +18 -0
- package/skills/devopsCloud/cloudflare/references/stream/api.md +21 -0
- package/skills/devopsCloud/cloudflare/references/stream/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/stream/gotchas.md +18 -0
- package/skills/devopsCloud/cloudflare/references/stream/patterns.md +22 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/README.md +21 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/configuration.md +15 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/gotchas.md +16 -0
- package/skills/devopsCloud/cloudflare/references/tail-workers/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/README.md +20 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/api.md +14 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/configuration.md +14 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/networking.md +14 -0
- package/skills/devopsCloud/cloudflare/references/tunnel/patterns.md +15 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/README.md +22 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/api.md +18 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/configuration.md +19 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/vectorize/patterns.md +24 -0
- package/skills/devopsCloud/cloudflare/references/waf/README.md +21 -0
- package/skills/devopsCloud/cloudflare/references/waf/api.md +17 -0
- package/skills/devopsCloud/cloudflare/references/waf/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/waf/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/waf/patterns.md +17 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/README.md +24 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/api.md +13 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/configuration.md +16 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/gotchas.md +15 -0
- package/skills/devopsCloud/cloudflare/references/workers-ai/patterns.md +14 -0
- package/skills/devopsCloud/cloudflare/references/workflows/README.md +23 -0
- package/skills/devopsCloud/cloudflare/references/workflows/api.md +17 -0
- package/skills/devopsCloud/cloudflare/references/workflows/configuration.md +18 -0
- package/skills/devopsCloud/cloudflare/references/workflows/gotchas.md +19 -0
- package/skills/devopsCloud/cloudflare/references/workflows/patterns.md +30 -0
- package/skills/devopsCloud/cloudflare/scripts/auditCloudflareProduction.py +95 -0
- package/skills/foundation/promptEvalTesting/SKILL.md +114 -0
- package/skills/foundation/promptEvalTesting/evals/promptEvalVerification.json +14 -0
- package/skills/foundation/promptEvalTesting/references/apiReference.md +3 -0
- package/skills/foundation/promptEvalTesting/references/evalMetricsCatalog.md +7 -0
- package/skills/foundation/promptEvalTesting/references/promptfooConfigSpecs.md +16 -0
- package/skills/foundation/promptEvalTesting/scripts/runPromptEvalSuite.py +29 -0
- package/skills/frontend/astro/SKILL.md +327 -0
- package/skills/frontend/astro/assets/README.md +71 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/content-collections.md +1061 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/data-fetching.md +109 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/images.md +719 -0
- package/skills/frontend/astro/assets/add-content-to-your-site/markdown.md +725 -0
- package/skills/frontend/astro/assets/build-your-ui/components.md +402 -0
- package/skills/frontend/astro/assets/build-your-ui/fonts.md +437 -0
- package/skills/frontend/astro/assets/build-your-ui/front-end-frameworks.md +245 -0
- package/skills/frontend/astro/assets/build-your-ui/layouts.md +267 -0
- package/skills/frontend/astro/assets/build-your-ui/scripts-and-event-handling.md +229 -0
- package/skills/frontend/astro/assets/build-your-ui/styles-and-css.md +782 -0
- package/skills/frontend/astro/assets/build-your-ui/syntax-highlighting.md +269 -0
- package/skills/frontend/astro/assets/configuration/build-with-ai.md +389 -0
- package/skills/frontend/astro/assets/configuration/configuration-overview.md +122 -0
- package/skills/frontend/astro/assets/configuration/dev-toolbar.md +86 -0
- package/skills/frontend/astro/assets/configuration/editor-setup.md +166 -0
- package/skills/frontend/astro/assets/configuration/environment-variables.md +352 -0
- package/skills/frontend/astro/assets/configuration/typescript.md +379 -0
- package/skills/frontend/astro/assets/configuration/working-with-integrations.md +606 -0
- package/skills/frontend/astro/assets/reference/adapter-reference.md +1242 -0
- package/skills/frontend/astro/assets/reference/cli-reference.md +575 -0
- package/skills/frontend/astro/assets/reference/configuration-reference.md +3144 -0
- package/skills/frontend/astro/assets/reference/content-loader-reference.md +1682 -0
- package/skills/frontend/astro/assets/reference/directives-reference.md +324 -0
- package/skills/frontend/astro/assets/reference/image-service-reference.md +346 -0
- package/skills/frontend/astro/assets/reference/integrations-reference.md +2813 -0
- package/skills/frontend/astro/assets/reference/modules/astro-actions.md +604 -0
- package/skills/frontend/astro/assets/reference/modules/astro-app.md +460 -0
- package/skills/frontend/astro/assets/reference/modules/astro-assets.md +1657 -0
- package/skills/frontend/astro/assets/reference/modules/astro-config.md +395 -0
- package/skills/frontend/astro/assets/reference/modules/astro-content.md +720 -0
- package/skills/frontend/astro/assets/reference/modules/astro-env.md +46 -0
- package/skills/frontend/astro/assets/reference/modules/astro-fetch.md +346 -0
- package/skills/frontend/astro/assets/reference/modules/astro-hono.md +37 -0
- package/skills/frontend/astro/assets/reference/modules/astro-i18n.md +462 -0
- package/skills/frontend/astro/assets/reference/modules/astro-middleware.md +292 -0
- package/skills/frontend/astro/assets/reference/modules/astro-static-paths.md +74 -0
- package/skills/frontend/astro/assets/reference/modules/astro-transitions.md +595 -0
- package/skills/frontend/astro/assets/reference/modules/astro-zod.md +120 -0
- package/skills/frontend/astro/assets/reference/session-driver-reference.md +205 -0
- package/skills/frontend/astro/assets/routing-and-navigation/endpoints.md +251 -0
- package/skills/frontend/astro/assets/routing-and-navigation/internationalization.md +374 -0
- package/skills/frontend/astro/assets/routing-and-navigation/middleware.md +288 -0
- package/skills/frontend/astro/assets/routing-and-navigation/pages.md +205 -0
- package/skills/frontend/astro/assets/routing-and-navigation/prefetch.md +273 -0
- package/skills/frontend/astro/assets/routing-and-navigation/routing.md +760 -0
- package/skills/frontend/astro/assets/routing-and-navigation/view-transitions.md +792 -0
- package/skills/frontend/astro/assets/server-rendering/actions.md +770 -0
- package/skills/frontend/astro/assets/server-rendering/caching.md +255 -0
- package/skills/frontend/astro/assets/server-rendering/on-demand-rendering.md +289 -0
- package/skills/frontend/astro/assets/server-rendering/server-islands.md +126 -0
- package/skills/frontend/astro/assets/server-rendering/sessions.md +270 -0
- package/skills/frontend/astro/assets/start-a-new-project/develop-and-build.md +147 -0
- package/skills/frontend/astro/assets/start-a-new-project/installation.md +342 -0
- package/skills/frontend/astro/assets/start-a-new-project/project-structure.md +137 -0
- package/skills/frontend/astro/assets/upgrade-and-troubleshooting/testing.md +412 -0
- package/skills/frontend/astro/assets/upgrade-and-troubleshooting/troubleshooting.md +229 -0
- package/skills/frontend/astro/assets/upgrade-and-troubleshooting/upgrade-astro.md +205 -0
- package/skills/frontend/astro/assets/welcome/courses.md +46 -0
- package/skills/frontend/astro/assets/welcome/islands-architecture.md +135 -0
- package/skills/frontend/astro/assets/welcome/why-astro.md +90 -0
- package/skills/frontend/astro/evals/evals.json +66 -0
- package/skills/frontend/astro/references/contentCollections.md +164 -0
- package/skills/frontend/astro/references/islandsArchitecture.md +128 -0
- package/skills/frontend/astro/references/serverIslandsAndActions.md +187 -0
- package/skills/frontend/astro/scripts/auditAstroProduction.py +78 -0
- package/skills/frontend/generativeUi/SKILL.md +128 -0
- package/skills/frontend/generativeUi/evals/generativeUiVerification.json +14 -0
- package/skills/frontend/generativeUi/references/apiReference.md +3 -0
- package/skills/frontend/generativeUi/references/clientToolComponentMapping.md +8 -0
- package/skills/frontend/generativeUi/references/dataStreamProtocol.md +10 -0
- package/skills/frontend/generativeUi/scripts/generateUiComponentStub.py +46 -0
- package/skills/frontend/nextjs/SKILL.md +138 -0
- package/skills/frontend/nextjs/assets/README.md +67 -0
- package/skills/frontend/nextjs/assets/api-reference/cli/create-next-app.md +210 -0
- package/skills/frontend/nextjs/assets/api-reference/cli/next.md +484 -0
- package/skills/frontend/nextjs/assets/api-reference/components/font.md +952 -0
- package/skills/frontend/nextjs/assets/api-reference/components/form.md +387 -0
- package/skills/frontend/nextjs/assets/api-reference/components/image.md +1372 -0
- package/skills/frontend/nextjs/assets/api-reference/components/link.md +954 -0
- package/skills/frontend/nextjs/assets/api-reference/components/script.md +421 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-cache-private.md +211 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-cache-remote.md +652 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-cache.md +848 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-client.md +149 -0
- package/skills/frontend/nextjs/assets/api-reference/directives/use-server.md +234 -0
- package/skills/frontend/nextjs/assets/api-reference/edge-runtime.md +188 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/default.md +80 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/dynamic-routes.md +417 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/error.md +361 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/forbidden.md +75 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/instrumentation-client.md +308 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/instrumentation.md +177 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/intercepting-routes.md +78 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/layout.md +803 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/loading.md +209 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/mdx-components.md +84 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/app-icons.md +302 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/manifest.md +90 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/opengraph-image.md +580 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/robots.md +234 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/metadata/sitemap.md +459 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/not-found.md +278 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/page.md +283 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/parallel-routes.md +517 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/proxy.md +857 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/public-folder.md +47 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-groups.md +40 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/dynamicParams.md +40 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/ensureStatic.md +195 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/instant.md +204 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/maxDuration.md +42 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/preferredRegion.md +55 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/prefetch.md +113 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route-segment-config/runtime.md +43 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/route.md +772 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/src-folder.md +42 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/template.md +174 -0
- package/skills/frontend/nextjs/assets/api-reference/file-conventions/unauthorized.md +143 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/after.md +332 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/cacheLife.md +642 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/cacheTag.md +272 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/catchError.md +267 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/connection.md +114 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/cookies.md +349 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/draft-mode.md +173 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/fetch.md +141 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/forbidden.md +327 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-image-metadata.md +311 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-metadata.md +1510 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-sitemaps.md +102 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-static-params.md +606 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/generate-viewport.md +347 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/headers.md +92 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/image-response.md +225 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/io.md +131 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/navigation.md +220 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/next-request.md +116 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/next-response.md +219 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/next-root-params.md +479 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/not-found.md +269 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/permanentRedirect.md +92 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/prefetch.md +202 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/redirect.md +255 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/refresh.md +91 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/revalidatePath.md +248 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/revalidateTag.md +175 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unauthorized.md +389 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unstable_cache.md +131 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unstable_noStore.md +61 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/unstable_rethrow.md +79 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/updateTag.md +173 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-link-status.md +268 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-offline.md +222 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-params.md +102 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-pathname.md +189 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-report-web-vitals.md +175 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-router.md +214 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-search-params.md +416 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-selected-layout-segment.md +214 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-selected-layout-segments.md +116 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/use-server-inserted-html.md +145 -0
- package/skills/frontend/nextjs/assets/api-reference/functions/userAgent.md +95 -0
- package/skills/frontend/nextjs/assets/api-reference/turbopack.md +552 -0
- package/skills/frontend/nextjs/assets/architecture/accessibility.md +47 -0
- package/skills/frontend/nextjs/assets/architecture/fast-refresh.md +122 -0
- package/skills/frontend/nextjs/assets/architecture/nextjs-compiler.md +376 -0
- package/skills/frontend/nextjs/assets/architecture/supported-browsers.md +146 -0
- package/skills/frontend/nextjs/assets/community/contribution-guide.md +459 -0
- package/skills/frontend/nextjs/assets/community/rspack.md +25 -0
- package/skills/frontend/nextjs/assets/getting-started/caching.md +626 -0
- package/skills/frontend/nextjs/assets/getting-started/css.md +336 -0
- package/skills/frontend/nextjs/assets/getting-started/deploying.md +115 -0
- package/skills/frontend/nextjs/assets/getting-started/error-handling.md +485 -0
- package/skills/frontend/nextjs/assets/getting-started/fetching-data.md +743 -0
- package/skills/frontend/nextjs/assets/getting-started/fonts.md +232 -0
- package/skills/frontend/nextjs/assets/getting-started/images.md +272 -0
- package/skills/frontend/nextjs/assets/getting-started/installation.md +446 -0
- package/skills/frontend/nextjs/assets/getting-started/layouts-and-pages.md +386 -0
- package/skills/frontend/nextjs/assets/getting-started/linking-and-navigating.md +475 -0
- package/skills/frontend/nextjs/assets/getting-started/metadata-and-og-images.md +370 -0
- package/skills/frontend/nextjs/assets/getting-started/mutating-data.md +679 -0
- package/skills/frontend/nextjs/assets/getting-started/project-structure.md +290 -0
- package/skills/frontend/nextjs/assets/getting-started/proxy.md +107 -0
- package/skills/frontend/nextjs/assets/getting-started/revalidating.md +241 -0
- package/skills/frontend/nextjs/assets/getting-started/route-handlers.md +233 -0
- package/skills/frontend/nextjs/assets/getting-started/server-and-client-components.md +683 -0
- package/skills/frontend/nextjs/assets/getting-started/upgrading.md +137 -0
- package/skills/frontend/nextjs/assets/glossary.md +315 -0
- package/skills/frontend/nextjs/evals/nextjsVerification.json +14 -0
- package/skills/frontend/nextjs/references/apiReference.md +3 -0
- package/skills/frontend/nextjs/references/dataAccessLayer.md +39 -0
- package/skills/frontend/nextjs/references/nextjsFeatureMap.md +276 -0
- package/skills/frontend/nextjs/references/productionChecklist.md +49 -0
- package/skills/frontend/nextjs/references/securityHeadersCsp.md +44 -0
- package/skills/frontend/nextjs/scripts/auditProductionReadiness.py +85 -0
- package/skills/frontend/shadcn-ui/SKILL.md +102 -0
- package/skills/frontend/shadcn-ui/assets/README.md +82 -0
- package/skills/frontend/shadcn-ui/assets/advanced/javascript.md +44 -0
- package/skills/frontend/shadcn-ui/assets/advanced/monorepo.md +254 -0
- package/skills/frontend/shadcn-ui/assets/advanced/react-19.md +166 -0
- package/skills/frontend/shadcn-ui/assets/advanced/tailwind-v4.md +333 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/chain-of-thought.md +519 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/chat.md +581 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/checkpoint.md +243 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/confirmation.md +382 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/context.md +188 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/file-tree.md +248 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/index.md +307 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/inline-citation.md +219 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/message.md +298 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/model-selector.md +368 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/plan.md +398 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/prompt-input.md +403 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/queue.md +517 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/reasoning.md +349 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/sources.md +303 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/stack-trace.md +514 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/subagent.md +551 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/suggestion.md +246 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/task.md +380 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/terminal.md +463 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/test-results.md +641 -0
- package/skills/frontend/shadcn-ui/assets/ai-elements/tool.md +915 -0
- package/skills/frontend/shadcn-ui/assets/components/accordion.md +490 -0
- package/skills/frontend/shadcn-ui/assets/components/alert-dialog.md +520 -0
- package/skills/frontend/shadcn-ui/assets/components/alert.md +351 -0
- package/skills/frontend/shadcn-ui/assets/components/aspect-ratio.md +206 -0
- package/skills/frontend/shadcn-ui/assets/components/attachment.md +715 -0
- package/skills/frontend/shadcn-ui/assets/components/avatar.md +581 -0
- package/skills/frontend/shadcn-ui/assets/components/badge.md +276 -0
- package/skills/frontend/shadcn-ui/assets/components/breadcrumb.md +556 -0
- package/skills/frontend/shadcn-ui/assets/components/bubble.md +706 -0
- package/skills/frontend/shadcn-ui/assets/components/button-group.md +969 -0
- package/skills/frontend/shadcn-ui/assets/components/button.md +523 -0
- package/skills/frontend/shadcn-ui/assets/components/calendar.md +959 -0
- package/skills/frontend/shadcn-ui/assets/components/card.md +684 -0
- package/skills/frontend/shadcn-ui/assets/components/carousel.md +643 -0
- package/skills/frontend/shadcn-ui/assets/components/chart.md +1295 -0
- package/skills/frontend/shadcn-ui/assets/components/checkbox.md +553 -0
- package/skills/frontend/shadcn-ui/assets/components/code-block.md +2041 -0
- package/skills/frontend/shadcn-ui/assets/components/collapsible.md +504 -0
- package/skills/frontend/shadcn-ui/assets/components/combobox.md +1102 -0
- package/skills/frontend/shadcn-ui/assets/components/command.md +682 -0
- package/skills/frontend/shadcn-ui/assets/components/context-menu.md +949 -0
- package/skills/frontend/shadcn-ui/assets/components/data-table.md +1667 -0
- package/skills/frontend/shadcn-ui/assets/components/date-picker.md +698 -0
- package/skills/frontend/shadcn-ui/assets/components/dialog.md +454 -0
- package/skills/frontend/shadcn-ui/assets/components/direction.md +205 -0
- package/skills/frontend/shadcn-ui/assets/components/drawer.md +806 -0
- package/skills/frontend/shadcn-ui/assets/components/dropdown-menu.md +1315 -0
- package/skills/frontend/shadcn-ui/assets/components/empty.md +562 -0
- package/skills/frontend/shadcn-ui/assets/components/field.md +1321 -0
- package/skills/frontend/shadcn-ui/assets/components/hover-card.md +342 -0
- package/skills/frontend/shadcn-ui/assets/components/index.md +82 -0
- package/skills/frontend/shadcn-ui/assets/components/input-group.md +980 -0
- package/skills/frontend/shadcn-ui/assets/components/input-otp.md +551 -0
- package/skills/frontend/shadcn-ui/assets/components/input.md +555 -0
- package/skills/frontend/shadcn-ui/assets/components/item.md +937 -0
- package/skills/frontend/shadcn-ui/assets/components/kbd.md +290 -0
- package/skills/frontend/shadcn-ui/assets/components/label.md +327 -0
- package/skills/frontend/shadcn-ui/assets/components/marker.md +445 -0
- package/skills/frontend/shadcn-ui/assets/components/menubar.md +804 -0
- package/skills/frontend/shadcn-ui/assets/components/message-scroller.md +2770 -0
- package/skills/frontend/shadcn-ui/assets/components/message.md +618 -0
- package/skills/frontend/shadcn-ui/assets/components/native-select.md +321 -0
- package/skills/frontend/shadcn-ui/assets/components/navigation-menu.md +568 -0
- package/skills/frontend/shadcn-ui/assets/components/pagination.md +425 -0
- package/skills/frontend/shadcn-ui/assets/components/popover.md +402 -0
- package/skills/frontend/shadcn-ui/assets/components/progress.md +240 -0
- package/skills/frontend/shadcn-ui/assets/components/questionnaire.md +2055 -0
- package/skills/frontend/shadcn-ui/assets/components/radio-group.md +440 -0
- package/skills/frontend/shadcn-ui/assets/components/resizable.md +302 -0
- package/skills/frontend/shadcn-ui/assets/components/scroll-area.md +226 -0
- package/skills/frontend/shadcn-ui/assets/components/select.md +647 -0
- package/skills/frontend/shadcn-ui/assets/components/separator.md +235 -0
- package/skills/frontend/shadcn-ui/assets/components/sheet.md +354 -0
- package/skills/frontend/shadcn-ui/assets/components/sidebar.md +1156 -0
- package/skills/frontend/shadcn-ui/assets/components/skeleton.md +217 -0
- package/skills/frontend/shadcn-ui/assets/components/slider.md +253 -0
- package/skills/frontend/shadcn-ui/assets/components/spinner.md +352 -0
- package/skills/frontend/shadcn-ui/assets/components/switch.md +296 -0
- package/skills/frontend/shadcn-ui/assets/components/table.md +572 -0
- package/skills/frontend/shadcn-ui/assets/components/tabs.md +425 -0
- package/skills/frontend/shadcn-ui/assets/components/textarea.md +218 -0
- package/skills/frontend/shadcn-ui/assets/components/toast.md +260 -0
- package/skills/frontend/shadcn-ui/assets/components/toggle-group.md +419 -0
- package/skills/frontend/shadcn-ui/assets/components/toggle.md +220 -0
- package/skills/frontend/shadcn-ui/assets/components/tooltip.md +332 -0
- package/skills/frontend/shadcn-ui/assets/components/trace.md +1890 -0
- package/skills/frontend/shadcn-ui/assets/components/typography.md +561 -0
- package/skills/frontend/shadcn-ui/assets/dark-mode/next.md +108 -0
- package/skills/frontend/shadcn-ui/assets/dark-mode/overview.md +75 -0
- package/skills/frontend/shadcn-ui/assets/dark-mode/vite.md +144 -0
- package/skills/frontend/shadcn-ui/assets/forms/next.md +716 -0
- package/skills/frontend/shadcn-ui/assets/forms/overview.md +60 -0
- package/skills/frontend/shadcn-ui/assets/forms/react-hook-form.md +2055 -0
- package/skills/frontend/shadcn-ui/assets/forms/tanstack-form.md +2236 -0
- package/skills/frontend/shadcn-ui/assets/installation/astro.md +252 -0
- package/skills/frontend/shadcn-ui/assets/installation/manual.md +255 -0
- package/skills/frontend/shadcn-ui/assets/installation/next.md +256 -0
- package/skills/frontend/shadcn-ui/assets/installation/react-router.md +226 -0
- package/skills/frontend/shadcn-ui/assets/installation/remix.md +52 -0
- package/skills/frontend/shadcn-ui/assets/installation/vite.md +314 -0
- package/skills/frontend/shadcn-ui/assets/mcp/mcp.md +338 -0
- package/skills/frontend/shadcn-ui/assets/overview/changelog.md +6 -0
- package/skills/frontend/shadcn-ui/assets/overview/cli.md +738 -0
- package/skills/frontend/shadcn-ui/assets/overview/components-json.md +379 -0
- package/skills/frontend/shadcn-ui/assets/overview/directory.md +74 -0
- package/skills/frontend/shadcn-ui/assets/overview/introduction.md +77 -0
- package/skills/frontend/shadcn-ui/assets/overview/skills.md +71 -0
- package/skills/frontend/shadcn-ui/assets/overview/theming.md +304 -0
- package/skills/frontend/shadcn-ui/assets/overview/typeset.md +242 -0
- package/skills/frontend/shadcn-ui/assets/registry/getting-started.md +648 -0
- package/skills/frontend/shadcn-ui/assets/registry/overview.md +90 -0
- package/skills/frontend/shadcn-ui/assets/registry/registry-item-json.md +483 -0
- package/skills/frontend/shadcn-ui/assets/registry/registry-json.md +178 -0
- package/skills/frontend/shadcn-ui/evals/componentVerification.json +19 -0
- package/skills/frontend/shadcn-ui/references/aiComponentsCatalog.md +51 -0
- package/skills/frontend/shadcn-ui/references/apiReference.md +3 -0
- package/skills/frontend/shadcn-ui/references/blocksCatalog.md +32 -0
- package/skills/frontend/shadcn-ui/references/cliCommands.md +47 -0
- package/skills/frontend/shadcn-ui/references/componentMarkdownSources.md +48 -0
- package/skills/frontend/shadcn-ui/scripts/fetchComponentDocs.py +43 -0
- package/skills/frontend/tsxReactStandard/SKILL.md +150 -0
- package/skills/frontend/tsxReactStandard/evals/tsxVerification.json +14 -0
- package/skills/frontend/tsxReactStandard/references/apiReference.md +3 -0
- package/skills/frontend/tsxReactStandard/references/discriminatedUnions.md +31 -0
- package/skills/frontend/tsxReactStandard/references/tsconfigStrict.md +36 -0
- package/skills/frontend/tsxReactStandard/scripts/validateTsxTypes.py +44 -0
- package/skills/gitVersionControl/gitWorkflow/SKILL.md +128 -0
- package/skills/gitVersionControl/gitWorkflow/assets/README.md +23 -0
- package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-environment.md +87 -0
- package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-formatting.md +156 -0
- package/skills/gitVersionControl/gitWorkflow/assets/cli/gh-reference.md +2363 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/about-git.md +156 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/about-remote-repositories.md +65 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/associating-text-editors-with-git.md +93 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/caching-your-github-credentials.md +115 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/getting-changes-from-a-remote-repository.md +76 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/ignoring-files.md +51 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/managing-remote-repositories.md +231 -0
- package/skills/gitVersionControl/gitWorkflow/assets/using-git/pushing-commits-to-a-remote-repository.md +119 -0
- package/skills/gitVersionControl/gitWorkflow/evals/evalGitWorkflow.py +43 -0
- package/skills/gitVersionControl/gitWorkflow/references/apiReference.md +3 -0
- package/skills/gitVersionControl/gitWorkflow/references/branchingModels.md +32 -0
- package/skills/gitVersionControl/gitWorkflow/scripts/diagnoseGitGraph.py +68 -0
- package/skills/github/assets/README.md +39 -0
- package/skills/github/assets/cli/gh-environment.md +87 -0
- package/skills/github/assets/cli/gh-formatting.md +156 -0
- package/skills/github/assets/cli/gh-reference.md +2363 -0
- package/skills/github/assets/docs-api/github-docs-api.md +60 -0
- package/skills/github/assets/rest-api/actions-secrets.md +1272 -0
- package/skills/github/assets/rest-api/actions-variables.md +1247 -0
- package/skills/github/assets/rest-api/actions-workflow-runs.md +1697 -0
- package/skills/github/assets/rest-api/actions-workflows.md +348 -0
- package/skills/github/assets/rest-api/authenticating.md +174 -0
- package/skills/github/assets/rest-api/branches.md +727 -0
- package/skills/github/assets/rest-api/checks-runs.md +1013 -0
- package/skills/github/assets/rest-api/checks-suites.md +1142 -0
- package/skills/github/assets/rest-api/code-scanning.md +2957 -0
- package/skills/github/assets/rest-api/collaborators.md +547 -0
- package/skills/github/assets/rest-api/commits.md +957 -0
- package/skills/github/assets/rest-api/dependabot-alerts.md +895 -0
- package/skills/github/assets/rest-api/orgs.md +1172 -0
- package/skills/github/assets/rest-api/overview.md +875 -0
- package/skills/github/assets/rest-api/pull-reviews.md +722 -0
- package/skills/github/assets/rest-api/pulls.md +1605 -0
- package/skills/github/assets/rest-api/quickstart.md +344 -0
- package/skills/github/assets/rest-api/releases.md +650 -0
- package/skills/github/assets/rest-api/repos.md +2957 -0
- package/skills/github/assets/rest-api/rules.md +1507 -0
- package/skills/github/assets/rest-api/secret-scanning.md +947 -0
- package/skills/github/assets/rest-api/teams.md +1690 -0
- package/skills/github/githubAction/SKILL.md +159 -0
- package/skills/github/githubAction/assets/README.md +38 -0
- package/skills/github/githubAction/assets/reference/contexts.md +918 -0
- package/skills/github/githubAction/assets/reference/dependency-caching.md +393 -0
- package/skills/github/githubAction/assets/reference/events-that-trigger-workflows.md +1348 -0
- package/skills/github/githubAction/assets/reference/expressions.md +441 -0
- package/skills/github/githubAction/assets/reference/metadata-syntax.md +803 -0
- package/skills/github/githubAction/assets/reference/variables.md +149 -0
- package/skills/github/githubAction/assets/reference/workflow-cancellation.md +22 -0
- package/skills/github/githubAction/assets/reference/workflow-commands.md +1056 -0
- package/skills/github/githubAction/assets/reference/workflow-syntax.md +1721 -0
- package/skills/github/githubAction/assets/rest-api/secrets.md +1272 -0
- package/skills/github/githubAction/assets/rest-api/workflow-runs.md +1697 -0
- package/skills/github/githubAction/assets/rest-api/workflows.md +348 -0
- package/skills/github/githubAction/assets/starter-workflows/automation/stale.yml +27 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/blank.yml +36 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/docker-image.yml +18 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/go.yml +28 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/maven.yml +35 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/node.js.yml +31 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/python-app.yml +39 -0
- package/skills/github/githubAction/assets/starter-workflows/ci/rust.yml +22 -0
- package/skills/github/githubAction/assets/starter-workflows/code-scanning/codeql.yml +97 -0
- package/skills/github/githubAction/evals/actionVerification.json +14 -0
- package/skills/github/githubAction/references/apiReference.md +3 -0
- package/skills/github/githubAction/references/workflowPatterns.md +81 -0
- package/skills/github/githubAction/scripts/validateWorkflowYaml.py +53 -0
- package/skills/github/githubQuality/SKILL.md +136 -0
- package/skills/github/githubQuality/assets/README.md +24 -0
- package/skills/github/githubQuality/assets/pull-requests/about-code-owners.md +178 -0
- package/skills/github/githubQuality/assets/pull-requests/about-merge-methods.md +48 -0
- package/skills/github/githubQuality/assets/pull-requests/creating-a-pull-request.md +170 -0
- package/skills/github/githubQuality/assets/pull-requests/giving-reviews.md +48 -0
- package/skills/github/githubQuality/assets/pull-requests/managing-a-merge-queue.md +134 -0
- package/skills/github/githubQuality/assets/pull-requests/merging-a-pull-request.md +101 -0
- package/skills/github/githubQuality/assets/pull-requests/resolving-reviews.md +59 -0
- package/skills/github/githubQuality/assets/pull-requests/status-checks.md +135 -0
- package/skills/github/githubQuality/assets/rest-api/checks-runs.md +1013 -0
- package/skills/github/githubQuality/assets/rest-api/checks-suites.md +1142 -0
- package/skills/github/githubQuality/assets/rest-api/commits.md +957 -0
- package/skills/github/githubQuality/assets/rest-api/pulls.md +1605 -0
- package/skills/github/githubQuality/assets/rest-api/reviews.md +722 -0
- package/skills/github/githubQuality/evals/qualityVerification.json +14 -0
- package/skills/github/githubQuality/references/apiReference.md +3 -0
- package/skills/github/githubQuality/references/codeownersExample.md +26 -0
- package/skills/github/githubQuality/references/prTemplate.md +20 -0
- package/skills/github/githubQuality/scripts/auditPrQuality.py +52 -0
- package/skills/github/githubSecurity/SKILL.md +170 -0
- package/skills/github/githubSecurity/assets/README.md +32 -0
- package/skills/github/githubSecurity/assets/code-scanning/code-scanning-alerts.md +133 -0
- package/skills/github/githubSecurity/assets/code-scanning/code-scanning.md +67 -0
- package/skills/github/githubSecurity/assets/code-scanning/codeql-code-scanning.md +79 -0
- package/skills/github/githubSecurity/assets/code-scanning/configure-code-scanning.md +121 -0
- package/skills/github/githubSecurity/assets/dependabot/about-the-dependabot-yml-file.md +74 -0
- package/skills/github/githubSecurity/assets/dependabot/dependabot-alerts.md +133 -0
- package/skills/github/githubSecurity/assets/dependabot/dependabot-security-updates.md +95 -0
- package/skills/github/githubSecurity/assets/dependabot/dependabot-version-updates.md +80 -0
- package/skills/github/githubSecurity/assets/rest-api/code-scanning.md +2957 -0
- package/skills/github/githubSecurity/assets/rest-api/dependabot-alerts.md +895 -0
- package/skills/github/githubSecurity/assets/rest-api/secret-scanning.md +947 -0
- package/skills/github/githubSecurity/assets/secret-scanning/enable-secret-scanning.md +59 -0
- package/skills/github/githubSecurity/assets/secret-scanning/secret-scanning.md +105 -0
- package/skills/github/githubSecurity/assets/security-advisories/github-advisory-database.md +148 -0
- package/skills/github/githubSecurity/evals/securityVerification.json +14 -0
- package/skills/github/githubSecurity/references/apiReference.md +3 -0
- package/skills/github/githubSecurity/references/codeqlAnalysis.yml +42 -0
- package/skills/github/githubSecurity/references/dependabotConfig.yml +27 -0
- package/skills/github/githubSecurity/scripts/auditRepoSecurity.py +47 -0
- package/skills/github/githubSetup/SKILL.md +137 -0
- package/skills/github/githubSetup/assets/README.md +40 -0
- package/skills/github/githubSetup/assets/branches/about-protected-branches.md +198 -0
- package/skills/github/githubSetup/assets/branches/changing-the-default-branch.md +49 -0
- package/skills/github/githubSetup/assets/branches/deleting-and-restoring-branches.md +44 -0
- package/skills/github/githubSetup/assets/branches/managing-a-branch-protection-rule.md +115 -0
- package/skills/github/githubSetup/assets/branches/renaming-a-branch.md +74 -0
- package/skills/github/githubSetup/assets/branches/viewing-branches-in-your-repository.md +30 -0
- package/skills/github/githubSetup/assets/repositories/about-repositories.md +127 -0
- package/skills/github/githubSetup/assets/repositories/cloning-a-repository.md +114 -0
- package/skills/github/githubSetup/assets/repositories/creating-a-new-repository.md +82 -0
- package/skills/github/githubSetup/assets/repositories/creating-a-repository-from-a-template.md +51 -0
- package/skills/github/githubSetup/assets/repositories/deleting-a-repository.md +34 -0
- package/skills/github/githubSetup/assets/repositories/managing-teams-and-people-with-access.md +69 -0
- package/skills/github/githubSetup/assets/repositories/renaming-a-repository.md +47 -0
- package/skills/github/githubSetup/assets/repositories/restoring-a-deleted-repository.md +61 -0
- package/skills/github/githubSetup/assets/repositories/setting-repository-visibility.md +137 -0
- package/skills/github/githubSetup/assets/rest-api/branches.md +727 -0
- package/skills/github/githubSetup/assets/rest-api/quickstart.md +344 -0
- package/skills/github/githubSetup/assets/rest-api/repos.md +2957 -0
- package/skills/github/githubSetup/assets/rulesets/about-rulesets.md +72 -0
- package/skills/github/githubSetup/assets/rulesets/available-rules-for-rulesets.md +383 -0
- package/skills/github/githubSetup/assets/rulesets/converting-branch-protections-to-rulesets.md +92 -0
- package/skills/github/githubSetup/assets/rulesets/creating-rulesets-for-a-repository.md +108 -0
- package/skills/github/githubSetup/assets/rulesets/managing-rulesets-for-a-repository.md +149 -0
- package/skills/github/githubSetup/assets/rulesets/troubleshooting-rules.md +122 -0
- package/skills/github/githubSetup/evals/setupVerification.json +14 -0
- package/skills/github/githubSetup/references/apiReference.md +3 -0
- package/skills/github/githubSetup/references/repoSettingsBlueprint.md +13 -0
- package/skills/github/githubSetup/references/rulesetTemplates.json +42 -0
- package/skills/github/githubSetup/scripts/configureRepoBaseline.py +46 -0
- package/skills/github/githubTeam/SKILL.md +115 -0
- package/skills/github/githubTeam/assets/README.md +21 -0
- package/skills/github/githubTeam/assets/organizations/about-organizations.md +69 -0
- package/skills/github/githubTeam/assets/organizations/repository-roles-for-an-organization.md +94 -0
- package/skills/github/githubTeam/assets/rest-api/collaborators.md +547 -0
- package/skills/github/githubTeam/assets/rest-api/orgs.md +1172 -0
- package/skills/github/githubTeam/assets/rest-api/teams.md +1690 -0
- package/skills/github/githubTeam/assets/teams/about-teams.md +82 -0
- package/skills/github/githubTeam/assets/teams/adding-members-to-a-team.md +55 -0
- package/skills/github/githubTeam/evals/teamVerification.json +14 -0
- package/skills/github/githubTeam/references/apiReference.md +3 -0
- package/skills/github/githubTeam/references/permissionMatrix.md +17 -0
- package/skills/github/githubTeam/references/reviewAssignment.md +17 -0
- package/skills/github/githubTeam/scripts/manageTeamSync.py +31 -0
- package/skills/securityQa/llmSecurityRedteaming/SKILL.md +86 -0
- package/skills/securityQa/llmSecurityRedteaming/evals/securityRedteamVerification.json +14 -0
- package/skills/securityQa/llmSecurityRedteaming/references/apiReference.md +3 -0
- package/skills/securityQa/llmSecurityRedteaming/references/jailbreakTaxonomy.md +6 -0
- package/skills/securityQa/llmSecurityRedteaming/references/owaspLlmTopTen.md +12 -0
- package/skills/securityQa/llmSecurityRedteaming/scripts/testPromptInjection.py +34 -0
- package/skills/softwareDevelopment/requirementsEngineering/SKILL.md +110 -0
- package/skills/softwareDevelopment/requirementsEngineering/evals/evalRequirements.py +33 -0
- package/skills/softwareDevelopment/requirementsEngineering/references/apiReference.md +3 -0
- package/skills/softwareDevelopment/requirementsEngineering/references/requirementsAnalysisModels.md +34 -0
- package/skills/softwareDevelopment/requirementsEngineering/scripts/validateUserStories.py +49 -0
- package/skills/testing/testDrivenDevelopment/SKILL.md +122 -0
- package/skills/testing/testDrivenDevelopment/evals/evalTdd.py +25 -0
- package/skills/testing/testDrivenDevelopment/references/apiReference.md +3 -0
- package/skills/testing/testDrivenDevelopment/references/testPyramidDoubles.md +35 -0
- package/skills/testing/testDrivenDevelopment/scripts/auditTestPyramid.py +58 -0
|
@@ -0,0 +1,1295 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Chart
|
|
3
|
+
description: Beautiful charts. Built using Recharts. Copy and paste into your apps.
|
|
4
|
+
base: base
|
|
5
|
+
component: true
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
<Callout className="mt-4">
|
|
9
|
+
|
|
10
|
+
**Updated:** The `chart` component now uses Recharts v3. If you're upgrading existing chart code, see [Updating to Recharts v3](#updating-to-recharts-v3).
|
|
11
|
+
|
|
12
|
+
</Callout>
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
"use client"
|
|
16
|
+
|
|
17
|
+
import * as React from "react"
|
|
18
|
+
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
|
|
19
|
+
|
|
20
|
+
import {
|
|
21
|
+
Card,
|
|
22
|
+
CardContent,
|
|
23
|
+
CardDescription,
|
|
24
|
+
CardHeader,
|
|
25
|
+
CardTitle,
|
|
26
|
+
} from "@/registry/new-york-v4/ui/card"
|
|
27
|
+
import {
|
|
28
|
+
ChartContainer,
|
|
29
|
+
ChartTooltip,
|
|
30
|
+
ChartTooltipContent,
|
|
31
|
+
type ChartConfig,
|
|
32
|
+
} from "@/registry/new-york-v4/ui/chart"
|
|
33
|
+
|
|
34
|
+
export const description = "An interactive bar chart"
|
|
35
|
+
|
|
36
|
+
const chartData = [
|
|
37
|
+
{ date: "2024-04-01", desktop: 222, mobile: 150 },
|
|
38
|
+
{ date: "2024-04-02", desktop: 97, mobile: 180 },
|
|
39
|
+
{ date: "2024-04-03", desktop: 167, mobile: 120 },
|
|
40
|
+
{ date: "2024-04-04", desktop: 242, mobile: 260 },
|
|
41
|
+
{ date: "2024-04-05", desktop: 373, mobile: 290 },
|
|
42
|
+
{ date: "2024-04-06", desktop: 301, mobile: 340 },
|
|
43
|
+
{ date: "2024-04-07", desktop: 245, mobile: 180 },
|
|
44
|
+
{ date: "2024-04-08", desktop: 409, mobile: 320 },
|
|
45
|
+
{ date: "2024-04-09", desktop: 59, mobile: 110 },
|
|
46
|
+
{ date: "2024-04-10", desktop: 261, mobile: 190 },
|
|
47
|
+
{ date: "2024-04-11", desktop: 327, mobile: 350 },
|
|
48
|
+
{ date: "2024-04-12", desktop: 292, mobile: 210 },
|
|
49
|
+
{ date: "2024-04-13", desktop: 342, mobile: 380 },
|
|
50
|
+
{ date: "2024-04-14", desktop: 137, mobile: 220 },
|
|
51
|
+
{ date: "2024-04-15", desktop: 120, mobile: 170 },
|
|
52
|
+
{ date: "2024-04-16", desktop: 138, mobile: 190 },
|
|
53
|
+
{ date: "2024-04-17", desktop: 446, mobile: 360 },
|
|
54
|
+
{ date: "2024-04-18", desktop: 364, mobile: 410 },
|
|
55
|
+
{ date: "2024-04-19", desktop: 243, mobile: 180 },
|
|
56
|
+
{ date: "2024-04-20", desktop: 89, mobile: 150 },
|
|
57
|
+
{ date: "2024-04-21", desktop: 137, mobile: 200 },
|
|
58
|
+
{ date: "2024-04-22", desktop: 224, mobile: 170 },
|
|
59
|
+
{ date: "2024-04-23", desktop: 138, mobile: 230 },
|
|
60
|
+
{ date: "2024-04-24", desktop: 387, mobile: 290 },
|
|
61
|
+
{ date: "2024-04-25", desktop: 215, mobile: 250 },
|
|
62
|
+
{ date: "2024-04-26", desktop: 75, mobile: 130 },
|
|
63
|
+
{ date: "2024-04-27", desktop: 383, mobile: 420 },
|
|
64
|
+
{ date: "2024-04-28", desktop: 122, mobile: 180 },
|
|
65
|
+
{ date: "2024-04-29", desktop: 315, mobile: 240 },
|
|
66
|
+
{ date: "2024-04-30", desktop: 454, mobile: 380 },
|
|
67
|
+
]
|
|
68
|
+
|
|
69
|
+
const chartConfig = {
|
|
70
|
+
views: {
|
|
71
|
+
label: "Page Views",
|
|
72
|
+
},
|
|
73
|
+
desktop: {
|
|
74
|
+
label: "Desktop",
|
|
75
|
+
color: "var(--chart-2)",
|
|
76
|
+
},
|
|
77
|
+
mobile: {
|
|
78
|
+
label: "Mobile",
|
|
79
|
+
color: "var(--chart-1)",
|
|
80
|
+
},
|
|
81
|
+
} satisfies ChartConfig
|
|
82
|
+
|
|
83
|
+
export function ChartDemo() {
|
|
84
|
+
const [activeChart, setActiveChart] =
|
|
85
|
+
React.useState<keyof typeof chartConfig>("desktop")
|
|
86
|
+
|
|
87
|
+
const total = React.useMemo(
|
|
88
|
+
() => ({
|
|
89
|
+
desktop: chartData.reduce((acc, curr) => acc + curr.desktop, 0),
|
|
90
|
+
mobile: chartData.reduce((acc, curr) => acc + curr.mobile, 0),
|
|
91
|
+
}),
|
|
92
|
+
[]
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<Card className="py-0 pb-4">
|
|
97
|
+
<CardHeader className="flex flex-col items-stretch border-b p-0! sm:flex-row">
|
|
98
|
+
<div className="flex flex-1 flex-col justify-center gap-1 px-6 pt-4 pb-3 sm:py-0!">
|
|
99
|
+
<CardTitle>Bar Chart - Interactive</CardTitle>
|
|
100
|
+
<CardDescription>
|
|
101
|
+
Showing total visitors for the last 3 months
|
|
102
|
+
</CardDescription>
|
|
103
|
+
</div>
|
|
104
|
+
<div className="flex">
|
|
105
|
+
{["desktop", "mobile"].map((key) => {
|
|
106
|
+
const chart = key as keyof typeof chartConfig
|
|
107
|
+
return (
|
|
108
|
+
<button
|
|
109
|
+
key={chart}
|
|
110
|
+
data-active={activeChart === chart}
|
|
111
|
+
className="relative z-30 flex flex-1 flex-col justify-center gap-1 border-t px-6 py-4 text-left even:border-l data-[active=true]:bg-muted/50 sm:border-t-0 sm:border-l sm:px-8 sm:py-6"
|
|
112
|
+
onClick={() => setActiveChart(chart)}
|
|
113
|
+
>
|
|
114
|
+
<span className="text-xs text-muted-foreground">
|
|
115
|
+
{chartConfig[chart].label}
|
|
116
|
+
</span>
|
|
117
|
+
<span className="text-lg leading-none font-bold sm:text-3xl">
|
|
118
|
+
{total[key as keyof typeof total].toLocaleString()}
|
|
119
|
+
</span>
|
|
120
|
+
</button>
|
|
121
|
+
)
|
|
122
|
+
})}
|
|
123
|
+
</div>
|
|
124
|
+
</CardHeader>
|
|
125
|
+
<CardContent className="px-2 sm:p-6">
|
|
126
|
+
<ChartContainer
|
|
127
|
+
config={chartConfig}
|
|
128
|
+
className="aspect-auto h-[250px] w-full"
|
|
129
|
+
>
|
|
130
|
+
<BarChart
|
|
131
|
+
accessibilityLayer
|
|
132
|
+
data={chartData}
|
|
133
|
+
margin={{
|
|
134
|
+
left: 12,
|
|
135
|
+
right: 12,
|
|
136
|
+
}}
|
|
137
|
+
>
|
|
138
|
+
<CartesianGrid vertical={false} />
|
|
139
|
+
<XAxis
|
|
140
|
+
dataKey="date"
|
|
141
|
+
tickLine={false}
|
|
142
|
+
axisLine={false}
|
|
143
|
+
tickMargin={8}
|
|
144
|
+
minTickGap={32}
|
|
145
|
+
tickFormatter={(value) => {
|
|
146
|
+
const date = new Date(value)
|
|
147
|
+
return date.toLocaleDateString("en-US", {
|
|
148
|
+
month: "short",
|
|
149
|
+
day: "numeric",
|
|
150
|
+
})
|
|
151
|
+
}}
|
|
152
|
+
/>
|
|
153
|
+
<ChartTooltip
|
|
154
|
+
content={
|
|
155
|
+
<ChartTooltipContent
|
|
156
|
+
className="w-[150px]"
|
|
157
|
+
nameKey="views"
|
|
158
|
+
labelFormatter={(value) => {
|
|
159
|
+
return new Date(value).toLocaleDateString("en-US", {
|
|
160
|
+
month: "short",
|
|
161
|
+
day: "numeric",
|
|
162
|
+
year: "numeric",
|
|
163
|
+
})
|
|
164
|
+
}}
|
|
165
|
+
/>
|
|
166
|
+
}
|
|
167
|
+
/>
|
|
168
|
+
<Bar dataKey={activeChart} fill={`var(--color-${activeChart})`} />
|
|
169
|
+
</BarChart>
|
|
170
|
+
</ChartContainer>
|
|
171
|
+
</CardContent>
|
|
172
|
+
</Card>
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Introducing **Charts**. A collection of chart components that you can copy and paste into your apps.
|
|
179
|
+
|
|
180
|
+
Charts are designed to look great out of the box. They work well with the other components and are fully customizable to fit your project.
|
|
181
|
+
|
|
182
|
+
[Browse the Charts Library](/charts).
|
|
183
|
+
|
|
184
|
+
## Component
|
|
185
|
+
|
|
186
|
+
We use [Recharts](https://recharts.org/) under the hood.
|
|
187
|
+
|
|
188
|
+
We designed the `chart` component with composition in mind. **You build your charts using Recharts components and only bring in custom components, such as `ChartTooltip`, when and where you need it**.
|
|
189
|
+
|
|
190
|
+
```tsx showLineNumbers /ChartContainer/ /ChartTooltipContent/
|
|
191
|
+
import { Bar, BarChart } from "recharts"
|
|
192
|
+
|
|
193
|
+
import { ChartContainer, ChartTooltipContent } from "@/components/ui/chart"
|
|
194
|
+
|
|
195
|
+
export function MyChart() {
|
|
196
|
+
return (
|
|
197
|
+
<ChartContainer>
|
|
198
|
+
<BarChart data={data}>
|
|
199
|
+
<Bar dataKey="value" />
|
|
200
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
201
|
+
</BarChart>
|
|
202
|
+
</ChartContainer>
|
|
203
|
+
)
|
|
204
|
+
}
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
We do not wrap Recharts. This means you're not locked into an abstraction. When a new Recharts version is released, you can follow the official upgrade path to upgrade your charts.
|
|
208
|
+
|
|
209
|
+
**The components are yours**.
|
|
210
|
+
|
|
211
|
+
## Updating to Recharts v3
|
|
212
|
+
|
|
213
|
+
If you're updating older chart code to Recharts v3:
|
|
214
|
+
|
|
215
|
+
- Use `var(--chart-1)` instead of `hsl(var(--chart-1))` when you reference chart tokens from your CSS variables.
|
|
216
|
+
- Use `ChartTooltip.defaultIndex` for initial tooltip state only. Keep persistent active shapes in your own chart state.
|
|
217
|
+
- Remove `layout` from `<Bar>` when the parent `<BarChart>` already defines it.
|
|
218
|
+
- Keep a height, `min-h-*`, or `aspect-*` on `ChartContainer` so `ResponsiveContainer` can measure on first render.
|
|
219
|
+
|
|
220
|
+
## Installation
|
|
221
|
+
|
|
222
|
+
<CodeTabs>
|
|
223
|
+
|
|
224
|
+
<TabsList>
|
|
225
|
+
<TabsTrigger value="cli">Command</TabsTrigger>
|
|
226
|
+
<TabsTrigger value="manual">Manual</TabsTrigger>
|
|
227
|
+
</TabsList>
|
|
228
|
+
<TabsContent value="cli">
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
npx shadcn@latest add chart
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
</TabsContent>
|
|
235
|
+
|
|
236
|
+
<TabsContent value="manual">
|
|
237
|
+
|
|
238
|
+
<Steps className="mb-0 pt-2">
|
|
239
|
+
|
|
240
|
+
<Step>Install the following dependencies:</Step>
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
npm install recharts
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
<Step>Copy and paste the following code into `components/ui/chart.tsx`.</Step>
|
|
247
|
+
|
|
248
|
+
<ComponentSource
|
|
249
|
+
name="chart"
|
|
250
|
+
title="components/ui/chart.tsx"
|
|
251
|
+
styleName="base-nova"
|
|
252
|
+
/>
|
|
253
|
+
|
|
254
|
+
<Step>Add the following colors to your CSS file</Step>
|
|
255
|
+
|
|
256
|
+
```css title="app/globals.css" showLineNumbers
|
|
257
|
+
@layer base {
|
|
258
|
+
:root {
|
|
259
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
260
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
261
|
+
--chart-3: oklch(0.398 0.07 227.392);
|
|
262
|
+
--chart-4: oklch(0.828 0.189 84.429);
|
|
263
|
+
--chart-5: oklch(0.769 0.188 70.08);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.dark {
|
|
267
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
268
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
269
|
+
--chart-3: oklch(0.769 0.188 70.08);
|
|
270
|
+
--chart-4: oklch(0.627 0.265 303.9);
|
|
271
|
+
--chart-5: oklch(0.645 0.246 16.439);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
</Steps>
|
|
277
|
+
|
|
278
|
+
</TabsContent>
|
|
279
|
+
|
|
280
|
+
</CodeTabs>
|
|
281
|
+
|
|
282
|
+
## Your First Chart
|
|
283
|
+
|
|
284
|
+
Let's build your first chart. We'll build a bar chart, add a grid, axis, tooltip and legend.
|
|
285
|
+
|
|
286
|
+
<Steps>
|
|
287
|
+
|
|
288
|
+
<Step>Start by defining your data</Step>
|
|
289
|
+
|
|
290
|
+
The following data represents the number of desktop and mobile users for each month.
|
|
291
|
+
|
|
292
|
+
<Callout className="mt-4">
|
|
293
|
+
|
|
294
|
+
**Note:** Your data can be in any shape. You are not limited to the shape of the data below. Use the `dataKey` prop to map your data to the chart.
|
|
295
|
+
|
|
296
|
+
</Callout>
|
|
297
|
+
|
|
298
|
+
```tsx title="components/example-chart.tsx" showLineNumbers
|
|
299
|
+
const chartData = [
|
|
300
|
+
{ month: "January", desktop: 186, mobile: 80 },
|
|
301
|
+
{ month: "February", desktop: 305, mobile: 200 },
|
|
302
|
+
{ month: "March", desktop: 237, mobile: 120 },
|
|
303
|
+
{ month: "April", desktop: 73, mobile: 190 },
|
|
304
|
+
{ month: "May", desktop: 209, mobile: 130 },
|
|
305
|
+
{ month: "June", desktop: 214, mobile: 140 },
|
|
306
|
+
]
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
<Step>Define your chart config</Step>
|
|
310
|
+
|
|
311
|
+
The chart config holds configuration for the chart. This is where you place human-readable strings, such as labels, icons and color tokens for theming.
|
|
312
|
+
|
|
313
|
+
```tsx title="components/example-chart.tsx" showLineNumbers
|
|
314
|
+
import { type ChartConfig } from "@/components/ui/chart"
|
|
315
|
+
|
|
316
|
+
const chartConfig = {
|
|
317
|
+
desktop: {
|
|
318
|
+
label: "Desktop",
|
|
319
|
+
color: "#2563eb",
|
|
320
|
+
},
|
|
321
|
+
mobile: {
|
|
322
|
+
label: "Mobile",
|
|
323
|
+
color: "#60a5fa",
|
|
324
|
+
},
|
|
325
|
+
} satisfies ChartConfig
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
<Step>Build your chart</Step>
|
|
329
|
+
|
|
330
|
+
You can now build your chart using Recharts components.
|
|
331
|
+
|
|
332
|
+
<Callout className="mt-4 bg-amber-50 border-amber-200 dark:bg-amber-950/50 dark:border-amber-950">
|
|
333
|
+
|
|
334
|
+
**Important:** Remember to set a `min-h-[VALUE]` on the `ChartContainer` component. This is required for the chart to be responsive.
|
|
335
|
+
|
|
336
|
+
</Callout>
|
|
337
|
+
|
|
338
|
+
```tsx
|
|
339
|
+
"use client"
|
|
340
|
+
|
|
341
|
+
import { Bar, BarChart } from "recharts"
|
|
342
|
+
|
|
343
|
+
import { ChartContainer, type ChartConfig } from "@/components/ui/chart"
|
|
344
|
+
|
|
345
|
+
const chartData = [
|
|
346
|
+
{ month: "January", desktop: 186, mobile: 80 },
|
|
347
|
+
{ month: "February", desktop: 305, mobile: 200 },
|
|
348
|
+
{ month: "March", desktop: 237, mobile: 120 },
|
|
349
|
+
{ month: "April", desktop: 73, mobile: 190 },
|
|
350
|
+
{ month: "May", desktop: 209, mobile: 130 },
|
|
351
|
+
{ month: "June", desktop: 214, mobile: 140 },
|
|
352
|
+
]
|
|
353
|
+
|
|
354
|
+
const chartConfig = {
|
|
355
|
+
desktop: {
|
|
356
|
+
label: "Desktop",
|
|
357
|
+
color: "#2563eb",
|
|
358
|
+
},
|
|
359
|
+
mobile: {
|
|
360
|
+
label: "Mobile",
|
|
361
|
+
color: "#60a5fa",
|
|
362
|
+
},
|
|
363
|
+
} satisfies ChartConfig
|
|
364
|
+
|
|
365
|
+
export function ChartExample() {
|
|
366
|
+
return (
|
|
367
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
368
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
369
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
370
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
371
|
+
</BarChart>
|
|
372
|
+
</ChartContainer>
|
|
373
|
+
)
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
```
|
|
377
|
+
|
|
378
|
+
</Steps>
|
|
379
|
+
|
|
380
|
+
### Add a Grid
|
|
381
|
+
|
|
382
|
+
Let's add a grid to the chart.
|
|
383
|
+
|
|
384
|
+
<Steps className="mb-0 pt-2">
|
|
385
|
+
|
|
386
|
+
<Step>Import the `CartesianGrid` component.</Step>
|
|
387
|
+
|
|
388
|
+
```tsx /CartesianGrid/
|
|
389
|
+
import { Bar, BarChart, CartesianGrid } from "recharts"
|
|
390
|
+
```
|
|
391
|
+
|
|
392
|
+
<Step>Add the `CartesianGrid` component to your chart.</Step>
|
|
393
|
+
|
|
394
|
+
```tsx showLineNumbers {3}
|
|
395
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
396
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
397
|
+
<CartesianGrid vertical={false} />
|
|
398
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
399
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
400
|
+
</BarChart>
|
|
401
|
+
</ChartContainer>
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
```tsx
|
|
405
|
+
"use client"
|
|
406
|
+
|
|
407
|
+
import { Bar, BarChart, CartesianGrid } from "recharts"
|
|
408
|
+
|
|
409
|
+
import { ChartContainer, type ChartConfig } from "@/components/ui/chart"
|
|
410
|
+
|
|
411
|
+
const chartData = [
|
|
412
|
+
{ month: "January", desktop: 186, mobile: 80 },
|
|
413
|
+
{ month: "February", desktop: 305, mobile: 200 },
|
|
414
|
+
{ month: "March", desktop: 237, mobile: 120 },
|
|
415
|
+
{ month: "April", desktop: 73, mobile: 190 },
|
|
416
|
+
{ month: "May", desktop: 209, mobile: 130 },
|
|
417
|
+
{ month: "June", desktop: 214, mobile: 140 },
|
|
418
|
+
]
|
|
419
|
+
|
|
420
|
+
const chartConfig = {
|
|
421
|
+
desktop: {
|
|
422
|
+
label: "Desktop",
|
|
423
|
+
color: "#2563eb",
|
|
424
|
+
},
|
|
425
|
+
mobile: {
|
|
426
|
+
label: "Mobile",
|
|
427
|
+
color: "#60a5fa",
|
|
428
|
+
},
|
|
429
|
+
} satisfies ChartConfig
|
|
430
|
+
|
|
431
|
+
export function ChartBarDemoGrid() {
|
|
432
|
+
return (
|
|
433
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
434
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
435
|
+
<CartesianGrid vertical={false} />
|
|
436
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
437
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
438
|
+
</BarChart>
|
|
439
|
+
</ChartContainer>
|
|
440
|
+
)
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
</Steps>
|
|
446
|
+
|
|
447
|
+
### Add an Axis
|
|
448
|
+
|
|
449
|
+
To add an x-axis to the chart, we'll use the `XAxis` component.
|
|
450
|
+
|
|
451
|
+
<Steps className="mb-0 pt-2">
|
|
452
|
+
|
|
453
|
+
<Step>Import the `XAxis` component.</Step>
|
|
454
|
+
|
|
455
|
+
```tsx /XAxis/
|
|
456
|
+
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
<Step>Add the `XAxis` component to your chart.</Step>
|
|
460
|
+
|
|
461
|
+
```tsx showLineNumbers {4-10}
|
|
462
|
+
<ChartContainer config={chartConfig} className="h-[200px] w-full">
|
|
463
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
464
|
+
<CartesianGrid vertical={false} />
|
|
465
|
+
<XAxis
|
|
466
|
+
dataKey="month"
|
|
467
|
+
tickLine={false}
|
|
468
|
+
tickMargin={10}
|
|
469
|
+
axisLine={false}
|
|
470
|
+
tickFormatter={(value) => value.slice(0, 3)}
|
|
471
|
+
/>
|
|
472
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
473
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
474
|
+
</BarChart>
|
|
475
|
+
</ChartContainer>
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
```tsx
|
|
479
|
+
"use client"
|
|
480
|
+
|
|
481
|
+
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
|
|
482
|
+
|
|
483
|
+
import { ChartContainer, type ChartConfig } from "@/components/ui/chart"
|
|
484
|
+
|
|
485
|
+
const chartData = [
|
|
486
|
+
{ month: "January", desktop: 186, mobile: 80 },
|
|
487
|
+
{ month: "February", desktop: 305, mobile: 200 },
|
|
488
|
+
{ month: "March", desktop: 237, mobile: 120 },
|
|
489
|
+
{ month: "April", desktop: 73, mobile: 190 },
|
|
490
|
+
{ month: "May", desktop: 209, mobile: 130 },
|
|
491
|
+
{ month: "June", desktop: 214, mobile: 140 },
|
|
492
|
+
]
|
|
493
|
+
|
|
494
|
+
const chartConfig = {
|
|
495
|
+
desktop: {
|
|
496
|
+
label: "Desktop",
|
|
497
|
+
color: "#2563eb",
|
|
498
|
+
},
|
|
499
|
+
mobile: {
|
|
500
|
+
label: "Mobile",
|
|
501
|
+
color: "#60a5fa",
|
|
502
|
+
},
|
|
503
|
+
} satisfies ChartConfig
|
|
504
|
+
|
|
505
|
+
export function ChartBarDemoAxis() {
|
|
506
|
+
return (
|
|
507
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
508
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
509
|
+
<CartesianGrid vertical={false} />
|
|
510
|
+
<XAxis
|
|
511
|
+
dataKey="month"
|
|
512
|
+
tickLine={false}
|
|
513
|
+
tickMargin={10}
|
|
514
|
+
axisLine={false}
|
|
515
|
+
tickFormatter={(value) => value.slice(0, 3)}
|
|
516
|
+
/>
|
|
517
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
518
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
519
|
+
</BarChart>
|
|
520
|
+
</ChartContainer>
|
|
521
|
+
)
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
</Steps>
|
|
527
|
+
|
|
528
|
+
### Add Tooltip
|
|
529
|
+
|
|
530
|
+
So far we've only used components from Recharts. They look great out of the box thanks to some customization in the `chart` component.
|
|
531
|
+
|
|
532
|
+
To add a tooltip, we'll use the custom `ChartTooltip` and `ChartTooltipContent` components from `chart`.
|
|
533
|
+
|
|
534
|
+
<Steps className="mb-0 pt-2">
|
|
535
|
+
|
|
536
|
+
<Step>Import the `ChartTooltip` and `ChartTooltipContent` components.</Step>
|
|
537
|
+
|
|
538
|
+
```tsx
|
|
539
|
+
import { ChartTooltip, ChartTooltipContent } from "@/components/ui/chart"
|
|
540
|
+
```
|
|
541
|
+
|
|
542
|
+
<Step>Add the components to your chart.</Step>
|
|
543
|
+
|
|
544
|
+
```tsx showLineNumbers {11}
|
|
545
|
+
<ChartContainer config={chartConfig} className="h-[200px] w-full">
|
|
546
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
547
|
+
<CartesianGrid vertical={false} />
|
|
548
|
+
<XAxis
|
|
549
|
+
dataKey="month"
|
|
550
|
+
tickLine={false}
|
|
551
|
+
tickMargin={10}
|
|
552
|
+
axisLine={false}
|
|
553
|
+
tickFormatter={(value) => value.slice(0, 3)}
|
|
554
|
+
/>
|
|
555
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
556
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
557
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
558
|
+
</BarChart>
|
|
559
|
+
</ChartContainer>
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
```tsx
|
|
563
|
+
"use client"
|
|
564
|
+
|
|
565
|
+
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
|
|
566
|
+
|
|
567
|
+
import {
|
|
568
|
+
ChartContainer,
|
|
569
|
+
ChartTooltip,
|
|
570
|
+
ChartTooltipContent,
|
|
571
|
+
type ChartConfig,
|
|
572
|
+
} from "@/components/ui/chart"
|
|
573
|
+
|
|
574
|
+
const chartData = [
|
|
575
|
+
{ month: "January", desktop: 186, mobile: 80 },
|
|
576
|
+
{ month: "February", desktop: 305, mobile: 200 },
|
|
577
|
+
{ month: "March", desktop: 237, mobile: 120 },
|
|
578
|
+
{ month: "April", desktop: 73, mobile: 190 },
|
|
579
|
+
{ month: "May", desktop: 209, mobile: 130 },
|
|
580
|
+
{ month: "June", desktop: 214, mobile: 140 },
|
|
581
|
+
]
|
|
582
|
+
|
|
583
|
+
const chartConfig = {
|
|
584
|
+
desktop: {
|
|
585
|
+
label: "Desktop",
|
|
586
|
+
color: "#2563eb",
|
|
587
|
+
},
|
|
588
|
+
mobile: {
|
|
589
|
+
label: "Mobile",
|
|
590
|
+
color: "#60a5fa",
|
|
591
|
+
},
|
|
592
|
+
} satisfies ChartConfig
|
|
593
|
+
|
|
594
|
+
export function ChartBarDemoTooltip() {
|
|
595
|
+
return (
|
|
596
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
597
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
598
|
+
<CartesianGrid vertical={false} />
|
|
599
|
+
<XAxis
|
|
600
|
+
dataKey="month"
|
|
601
|
+
tickLine={false}
|
|
602
|
+
tickMargin={10}
|
|
603
|
+
axisLine={false}
|
|
604
|
+
tickFormatter={(value) => value.slice(0, 3)}
|
|
605
|
+
/>
|
|
606
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
607
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
608
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
609
|
+
</BarChart>
|
|
610
|
+
</ChartContainer>
|
|
611
|
+
)
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
```
|
|
615
|
+
|
|
616
|
+
Hover to see the tooltips. Easy, right? Two components, and we've got a beautiful tooltip.
|
|
617
|
+
|
|
618
|
+
</Steps>
|
|
619
|
+
|
|
620
|
+
### Add Legend
|
|
621
|
+
|
|
622
|
+
We'll do the same for the legend. We'll use the `ChartLegend` and `ChartLegendContent` components from `chart`.
|
|
623
|
+
|
|
624
|
+
<Steps className="mb-0 pt-2">
|
|
625
|
+
|
|
626
|
+
<Step>Import the `ChartLegend` and `ChartLegendContent` components.</Step>
|
|
627
|
+
|
|
628
|
+
```tsx
|
|
629
|
+
import { ChartLegend, ChartLegendContent } from "@/components/ui/chart"
|
|
630
|
+
```
|
|
631
|
+
|
|
632
|
+
<Step>Add the components to your chart.</Step>
|
|
633
|
+
|
|
634
|
+
```tsx showLineNumbers {12}
|
|
635
|
+
<ChartContainer config={chartConfig} className="h-[200px] w-full">
|
|
636
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
637
|
+
<CartesianGrid vertical={false} />
|
|
638
|
+
<XAxis
|
|
639
|
+
dataKey="month"
|
|
640
|
+
tickLine={false}
|
|
641
|
+
tickMargin={10}
|
|
642
|
+
axisLine={false}
|
|
643
|
+
tickFormatter={(value) => value.slice(0, 3)}
|
|
644
|
+
/>
|
|
645
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
646
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
647
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
648
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
649
|
+
</BarChart>
|
|
650
|
+
</ChartContainer>
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
```tsx
|
|
654
|
+
"use client"
|
|
655
|
+
|
|
656
|
+
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
|
|
657
|
+
|
|
658
|
+
import {
|
|
659
|
+
ChartContainer,
|
|
660
|
+
ChartLegend,
|
|
661
|
+
ChartLegendContent,
|
|
662
|
+
ChartTooltip,
|
|
663
|
+
ChartTooltipContent,
|
|
664
|
+
type ChartConfig,
|
|
665
|
+
} from "@/components/ui/chart"
|
|
666
|
+
|
|
667
|
+
const chartData = [
|
|
668
|
+
{ month: "January", desktop: 186, mobile: 80 },
|
|
669
|
+
{ month: "February", desktop: 305, mobile: 200 },
|
|
670
|
+
{ month: "March", desktop: 237, mobile: 120 },
|
|
671
|
+
{ month: "April", desktop: 73, mobile: 190 },
|
|
672
|
+
{ month: "May", desktop: 209, mobile: 130 },
|
|
673
|
+
{ month: "June", desktop: 214, mobile: 140 },
|
|
674
|
+
]
|
|
675
|
+
|
|
676
|
+
const chartConfig = {
|
|
677
|
+
desktop: {
|
|
678
|
+
label: "Desktop",
|
|
679
|
+
color: "#2563eb",
|
|
680
|
+
},
|
|
681
|
+
mobile: {
|
|
682
|
+
label: "Mobile",
|
|
683
|
+
color: "#60a5fa",
|
|
684
|
+
},
|
|
685
|
+
} satisfies ChartConfig
|
|
686
|
+
|
|
687
|
+
export function ChartBarDemoLegend() {
|
|
688
|
+
return (
|
|
689
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
690
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
691
|
+
<CartesianGrid vertical={false} />
|
|
692
|
+
<XAxis
|
|
693
|
+
dataKey="month"
|
|
694
|
+
tickLine={false}
|
|
695
|
+
tickMargin={10}
|
|
696
|
+
axisLine={false}
|
|
697
|
+
tickFormatter={(value) => value.slice(0, 3)}
|
|
698
|
+
/>
|
|
699
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
700
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
701
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
702
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
703
|
+
</BarChart>
|
|
704
|
+
</ChartContainer>
|
|
705
|
+
)
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
```
|
|
709
|
+
|
|
710
|
+
</Steps>
|
|
711
|
+
|
|
712
|
+
Done. You've built your first chart! What's next?
|
|
713
|
+
|
|
714
|
+
- [Themes and Colors](/docs/components/chart#theming)
|
|
715
|
+
- [Tooltip](/docs/components/chart#tooltip)
|
|
716
|
+
- [Legend](/docs/components/chart#legend)
|
|
717
|
+
|
|
718
|
+
## Chart Config
|
|
719
|
+
|
|
720
|
+
The chart config is where you define the labels, icons and colors for a chart.
|
|
721
|
+
|
|
722
|
+
It is intentionally decoupled from chart data.
|
|
723
|
+
|
|
724
|
+
This allows you to share config and color tokens between charts. It can also work independently for cases where your data or color tokens live remotely or in a different format.
|
|
725
|
+
|
|
726
|
+
```tsx showLineNumbers /ChartConfig/
|
|
727
|
+
import { Monitor } from "lucide-react"
|
|
728
|
+
|
|
729
|
+
import { type ChartConfig } from "@/components/ui/chart"
|
|
730
|
+
|
|
731
|
+
const chartConfig = {
|
|
732
|
+
desktop: {
|
|
733
|
+
label: "Desktop",
|
|
734
|
+
icon: Monitor,
|
|
735
|
+
// A color like 'hsl(220, 98%, 61%)' or 'var(--color-name)'
|
|
736
|
+
color: "#2563eb",
|
|
737
|
+
// OR a theme object with 'light' and 'dark' keys
|
|
738
|
+
theme: {
|
|
739
|
+
light: "#2563eb",
|
|
740
|
+
dark: "#dc2626",
|
|
741
|
+
},
|
|
742
|
+
},
|
|
743
|
+
} satisfies ChartConfig
|
|
744
|
+
```
|
|
745
|
+
|
|
746
|
+
## Theming
|
|
747
|
+
|
|
748
|
+
Charts have built-in support for theming. You can use css variables (recommended) or color values in any color format, such as hex, hsl or oklch.
|
|
749
|
+
|
|
750
|
+
### CSS Variables
|
|
751
|
+
|
|
752
|
+
<Steps className="mb-0 pt-2">
|
|
753
|
+
|
|
754
|
+
<Step>Define your colors in your css file</Step>
|
|
755
|
+
|
|
756
|
+
```css title="app/globals.css" showLineNumbers
|
|
757
|
+
@layer base {
|
|
758
|
+
:root {
|
|
759
|
+
--chart-1: oklch(0.646 0.222 41.116);
|
|
760
|
+
--chart-2: oklch(0.6 0.118 184.704);
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
.dark {
|
|
764
|
+
--chart-1: oklch(0.488 0.243 264.376);
|
|
765
|
+
--chart-2: oklch(0.696 0.17 162.48);
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
```
|
|
769
|
+
|
|
770
|
+
<Step>Add the color to your `chartConfig`</Step>
|
|
771
|
+
|
|
772
|
+
```tsx title="components/example-chart.tsx" showLineNumbers
|
|
773
|
+
const chartConfig = {
|
|
774
|
+
desktop: {
|
|
775
|
+
label: "Desktop",
|
|
776
|
+
color: "var(--chart-1)",
|
|
777
|
+
},
|
|
778
|
+
mobile: {
|
|
779
|
+
label: "Mobile",
|
|
780
|
+
color: "var(--chart-2)",
|
|
781
|
+
},
|
|
782
|
+
} satisfies ChartConfig
|
|
783
|
+
```
|
|
784
|
+
|
|
785
|
+
</Steps>
|
|
786
|
+
|
|
787
|
+
### hex, hsl or oklch
|
|
788
|
+
|
|
789
|
+
You can also define your colors directly in the chart config. Use the color format you prefer.
|
|
790
|
+
|
|
791
|
+
```tsx title="components/example-chart.tsx" showLineNumbers
|
|
792
|
+
const chartConfig = {
|
|
793
|
+
desktop: {
|
|
794
|
+
label: "Desktop",
|
|
795
|
+
color: "#2563eb",
|
|
796
|
+
},
|
|
797
|
+
mobile: {
|
|
798
|
+
label: "Mobile",
|
|
799
|
+
color: "hsl(220, 98%, 61%)",
|
|
800
|
+
},
|
|
801
|
+
tablet: {
|
|
802
|
+
label: "Tablet",
|
|
803
|
+
color: "oklch(0.5 0.2 240)",
|
|
804
|
+
},
|
|
805
|
+
laptop: {
|
|
806
|
+
label: "Laptop",
|
|
807
|
+
color: "var(--chart-2)",
|
|
808
|
+
},
|
|
809
|
+
} satisfies ChartConfig
|
|
810
|
+
```
|
|
811
|
+
|
|
812
|
+
### Using Colors
|
|
813
|
+
|
|
814
|
+
To use the theme colors in your chart, reference the colors using the format `var(--color-KEY)`.
|
|
815
|
+
|
|
816
|
+
#### Components
|
|
817
|
+
|
|
818
|
+
```tsx
|
|
819
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" />
|
|
820
|
+
```
|
|
821
|
+
|
|
822
|
+
#### Chart Data
|
|
823
|
+
|
|
824
|
+
```tsx title="components/example-chart.tsx" showLineNumbers
|
|
825
|
+
const chartData = [
|
|
826
|
+
{ browser: "chrome", visitors: 275, fill: "var(--color-chrome)" },
|
|
827
|
+
{ browser: "safari", visitors: 200, fill: "var(--color-safari)" },
|
|
828
|
+
]
|
|
829
|
+
```
|
|
830
|
+
|
|
831
|
+
#### Tailwind
|
|
832
|
+
|
|
833
|
+
```tsx title="components/example-chart.tsx"
|
|
834
|
+
<LabelList className="fill-(--color-desktop)" />
|
|
835
|
+
```
|
|
836
|
+
|
|
837
|
+
## Tooltip
|
|
838
|
+
|
|
839
|
+
A chart tooltip contains a label, name, indicator and value. You can use a combination of these to customize your tooltip.
|
|
840
|
+
|
|
841
|
+
```tsx
|
|
842
|
+
"use client"
|
|
843
|
+
|
|
844
|
+
import * as React from "react"
|
|
845
|
+
import { cn } from "cn"
|
|
846
|
+
|
|
847
|
+
export function ChartTooltipDemo() {
|
|
848
|
+
return (
|
|
849
|
+
<div className="grid aspect-video w-full max-w-md justify-center text-foreground md:grid-cols-2 [&>div]:relative [&>div]:flex [&>div]:h-[137px] [&>div]:w-[224px] [&>div]:items-center [&>div]:justify-center [&>div]:p-4">
|
|
850
|
+
<div>
|
|
851
|
+
<div className="absolute top-[45px] left-[-35px] z-10 text-sm font-medium">
|
|
852
|
+
Label
|
|
853
|
+
</div>
|
|
854
|
+
<svg
|
|
855
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
856
|
+
viewBox="0 0 193 40"
|
|
857
|
+
width="50"
|
|
858
|
+
height="12"
|
|
859
|
+
fill="none"
|
|
860
|
+
className="absolute top-[50px] left-[5px] z-10"
|
|
861
|
+
>
|
|
862
|
+
<g clipPath="url(#a)">
|
|
863
|
+
<path
|
|
864
|
+
fill="currentColor"
|
|
865
|
+
d="M173.928 21.13C115.811 44.938 58.751 45.773 0 26.141c4.227-4.386 7.82-2.715 10.567-1.88 21.133 5.64 42.9 6.266 64.457 7.101 31.066 1.253 60.441-5.848 89.183-17.335 1.268-.418 2.325-1.253 4.861-2.924-14.582-2.924-29.165 2.089-41.845-3.76.212-.835.212-1.879.423-2.714 9.51-.627 19.231-1.253 28.742-2.089 9.51-.835 18.808-1.88 28.318-2.506 6.974-.418 9.933 2.924 7.397 9.19-3.17 8.145-7.608 15.664-11.623 23.391-.423.836-1.057 1.88-1.902 2.298-2.325.835-4.65 1.044-7.186 1.67-.422-2.088-1.479-4.386-1.268-6.265.423-2.506 1.902-4.595 3.804-9.19Z"
|
|
866
|
+
/>
|
|
867
|
+
</g>
|
|
868
|
+
<defs>
|
|
869
|
+
<clipPath id="a">
|
|
870
|
+
<path fill="currentColor" d="M0 0h193v40H0z" />
|
|
871
|
+
</clipPath>
|
|
872
|
+
</defs>
|
|
873
|
+
</svg>
|
|
874
|
+
<TooltipDemo
|
|
875
|
+
label="Page Views"
|
|
876
|
+
payload={[
|
|
877
|
+
{ name: "Desktop", value: 186, fill: "var(--chart-1)" },
|
|
878
|
+
{ name: "Mobile", value: 80, fill: "var(--chart-2)" },
|
|
879
|
+
]}
|
|
880
|
+
className="w-[8rem]"
|
|
881
|
+
/>
|
|
882
|
+
</div>
|
|
883
|
+
<div className="items-end">
|
|
884
|
+
<div className="absolute top-[0px] left-[122px] z-10 text-sm font-medium">
|
|
885
|
+
Name
|
|
886
|
+
</div>
|
|
887
|
+
<svg
|
|
888
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
889
|
+
width="35"
|
|
890
|
+
height="42"
|
|
891
|
+
fill="none"
|
|
892
|
+
viewBox="0 0 122 148"
|
|
893
|
+
className="absolute top-[10px] left-[85px] z-10 -scale-x-100"
|
|
894
|
+
>
|
|
895
|
+
<g clipPath="url(#ab)">
|
|
896
|
+
<path
|
|
897
|
+
fill="currentColor"
|
|
898
|
+
d="M0 2.65c6.15-4.024 12.299-2.753 17.812-.847a115.56 115.56 0 0 1 21.84 10.59C70.4 32.727 88.849 61.744 96.483 97.54c1.908 9.108 2.544 18.639 3.817 29.017 8.481-4.871 12.934-14.402 21.416-19.909 1.061 4.236-1.06 6.989-2.756 9.319-6.998 9.531-14.207 19.062-21.63 28.382-3.604 4.448-6.36 4.871-10.177 1.059-8.058-7.837-12.935-17.368-14.42-28.382 0-.424.636-1.059 1.485-2.118 9.118 2.33 6.997 13.979 14.843 18.215 3.393-14.614.848-28.593-2.969-42.149-4.029-14.19-9.33-27.746-17.812-39.82-8.27-11.86-18.66-21.392-30.11-30.287C26.93 11.758 14.207 6.039 0 2.65Z"
|
|
899
|
+
/>
|
|
900
|
+
</g>
|
|
901
|
+
<defs>
|
|
902
|
+
<clipPath id="ab">
|
|
903
|
+
<path fill="currentColor" d="M0 0h122v148H0z" />
|
|
904
|
+
</clipPath>
|
|
905
|
+
</defs>
|
|
906
|
+
</svg>
|
|
907
|
+
<TooltipDemo
|
|
908
|
+
label="Browser"
|
|
909
|
+
hideLabel
|
|
910
|
+
payload={[
|
|
911
|
+
{ name: "Chrome", value: 1286, fill: "var(--chart-3)" },
|
|
912
|
+
{ name: "Firefox", value: 1000, fill: "var(--chart-4)" },
|
|
913
|
+
]}
|
|
914
|
+
indicator="dashed"
|
|
915
|
+
className="w-[8rem]"
|
|
916
|
+
/>
|
|
917
|
+
</div>
|
|
918
|
+
<div className="hidden! md:flex!">
|
|
919
|
+
<TooltipDemo
|
|
920
|
+
label="Page Views"
|
|
921
|
+
payload={[{ name: "Desktop", value: 12486, fill: "var(--chart-3)" }]}
|
|
922
|
+
className="w-[9rem]"
|
|
923
|
+
indicator="line"
|
|
924
|
+
/>
|
|
925
|
+
</div>
|
|
926
|
+
<div className="items-start! justify-start!">
|
|
927
|
+
<div className="absolute top-[60px] left-[50px] z-10 text-sm font-medium">
|
|
928
|
+
Indicator
|
|
929
|
+
</div>
|
|
930
|
+
<TooltipDemo
|
|
931
|
+
label="Browser"
|
|
932
|
+
hideLabel
|
|
933
|
+
payload={[{ name: "Chrome", value: 1286, fill: "var(--chart-1)" }]}
|
|
934
|
+
indicator="dot"
|
|
935
|
+
className="w-[8rem]"
|
|
936
|
+
/>
|
|
937
|
+
<svg
|
|
938
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
939
|
+
width="15"
|
|
940
|
+
height="34"
|
|
941
|
+
fill="none"
|
|
942
|
+
viewBox="0 0 75 175"
|
|
943
|
+
className="absolute top-[38px] left-[30px] z-10 rotate-[-40deg]"
|
|
944
|
+
>
|
|
945
|
+
<g clipPath="url(#abc)">
|
|
946
|
+
<path
|
|
947
|
+
fill="currentColor"
|
|
948
|
+
d="M20.187 175c-4.439-2.109-7.186-2.531-8.032-4.008-3.17-5.484-6.763-10.968-8.454-17.084-5.073-16.242-4.439-32.694-1.057-49.146 5.707-28.053 18.388-52.942 34.24-76.565 1.692-2.531 3.171-5.063 4.862-7.805 0-.21-.211-.632-.634-1.265-4.65 1.265-9.511 2.53-14.161 3.585-2.537.422-5.496.422-8.032-.421-1.48-.422-3.593-2.742-3.593-4.219 0-1.898 1.48-4.218 2.747-5.906 1.057-1.054 2.96-1.265 4.65-1.687C35.406 7.315 48.088 3.729 60.98.776c10.99-2.53 14.584 1.055 13.95 11.812-.634 11.18-.846 22.358-1.268 33.326-.212 3.375-.846 6.96-1.268 10.757-8.878-4.007-8.878-4.007-12.048-38.177C47.03 33.259 38.153 49.289 29.91 65.741 21.667 82.193 16.17 99.49 13.212 117.84c-2.959 18.984.634 36.912 6.975 57.161Z"
|
|
949
|
+
/>
|
|
950
|
+
</g>
|
|
951
|
+
<defs>
|
|
952
|
+
<clipPath id="abc">
|
|
953
|
+
<path fill="currentColor" d="M0 0h75v175H0z" />
|
|
954
|
+
</clipPath>
|
|
955
|
+
</defs>
|
|
956
|
+
</svg>
|
|
957
|
+
</div>
|
|
958
|
+
</div>
|
|
959
|
+
)
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
function TooltipDemo({
|
|
963
|
+
indicator = "dot",
|
|
964
|
+
label,
|
|
965
|
+
payload,
|
|
966
|
+
hideLabel,
|
|
967
|
+
hideIndicator,
|
|
968
|
+
className,
|
|
969
|
+
}: {
|
|
970
|
+
label: string
|
|
971
|
+
hideLabel?: boolean
|
|
972
|
+
hideIndicator?: boolean
|
|
973
|
+
indicator?: "line" | "dot" | "dashed"
|
|
974
|
+
payload: {
|
|
975
|
+
name: string
|
|
976
|
+
value: number
|
|
977
|
+
fill: string
|
|
978
|
+
}[]
|
|
979
|
+
nameKey?: string
|
|
980
|
+
labelKey?: string
|
|
981
|
+
} & React.ComponentProps<"div">) {
|
|
982
|
+
const tooltipLabel = hideLabel ? null : (
|
|
983
|
+
<div className="font-medium">{label}</div>
|
|
984
|
+
)
|
|
985
|
+
|
|
986
|
+
if (!payload?.length) {
|
|
987
|
+
return null
|
|
988
|
+
}
|
|
989
|
+
|
|
990
|
+
const nestLabel = payload.length === 1 && indicator !== "dot"
|
|
991
|
+
|
|
992
|
+
return (
|
|
993
|
+
<div
|
|
994
|
+
className={cn(
|
|
995
|
+
"grid min-w-[8rem] items-start gap-1.5 rounded-lg border border-border/50 bg-background px-2.5 py-1.5 text-xs shadow-xl transition-all ease-in-out hover:-translate-y-0.5",
|
|
996
|
+
className
|
|
997
|
+
)}
|
|
998
|
+
>
|
|
999
|
+
{!nestLabel ? tooltipLabel : null}
|
|
1000
|
+
<div className="grid gap-1.5">
|
|
1001
|
+
{payload.map((item, index) => {
|
|
1002
|
+
const indicatorColor = item.fill
|
|
1003
|
+
|
|
1004
|
+
return (
|
|
1005
|
+
<div
|
|
1006
|
+
key={index}
|
|
1007
|
+
className={cn(
|
|
1008
|
+
"flex w-full items-stretch gap-2 [&>svg]:h-2.5 [&>svg]:w-2.5 [&>svg]:text-muted-foreground",
|
|
1009
|
+
indicator === "dot" && "items-center"
|
|
1010
|
+
)}
|
|
1011
|
+
>
|
|
1012
|
+
<>
|
|
1013
|
+
{!hideIndicator && (
|
|
1014
|
+
<div
|
|
1015
|
+
className={cn(
|
|
1016
|
+
"shrink-0 rounded-[2px] border-(--color-border) bg-(--color-bg)",
|
|
1017
|
+
{
|
|
1018
|
+
"h-2.5 w-2.5": indicator === "dot",
|
|
1019
|
+
"w-1": indicator === "line",
|
|
1020
|
+
"w-0 border-[1.5px] border-dashed bg-transparent":
|
|
1021
|
+
indicator === "dashed",
|
|
1022
|
+
"my-0.5": nestLabel && indicator === "dashed",
|
|
1023
|
+
}
|
|
1024
|
+
)}
|
|
1025
|
+
style={
|
|
1026
|
+
{
|
|
1027
|
+
"--color-bg": indicatorColor,
|
|
1028
|
+
"--color-border": indicatorColor,
|
|
1029
|
+
} as React.CSSProperties
|
|
1030
|
+
}
|
|
1031
|
+
/>
|
|
1032
|
+
)}
|
|
1033
|
+
<div
|
|
1034
|
+
className={cn(
|
|
1035
|
+
"flex flex-1 justify-between leading-none",
|
|
1036
|
+
nestLabel ? "items-end" : "items-center"
|
|
1037
|
+
)}
|
|
1038
|
+
>
|
|
1039
|
+
<div className="grid gap-1.5">
|
|
1040
|
+
{nestLabel ? tooltipLabel : null}
|
|
1041
|
+
<span className="text-muted-foreground">{item.name}</span>
|
|
1042
|
+
</div>
|
|
1043
|
+
<span className="font-mono font-medium text-foreground tabular-nums">
|
|
1044
|
+
{item.value.toLocaleString()}
|
|
1045
|
+
</span>
|
|
1046
|
+
</div>
|
|
1047
|
+
</>
|
|
1048
|
+
</div>
|
|
1049
|
+
)
|
|
1050
|
+
})}
|
|
1051
|
+
</div>
|
|
1052
|
+
</div>
|
|
1053
|
+
)
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
```
|
|
1057
|
+
|
|
1058
|
+
You can turn on/off any of these using the `hideLabel`, `hideIndicator` props and customize the indicator style using the `indicator` prop.
|
|
1059
|
+
|
|
1060
|
+
Use `labelKey` and `nameKey` to use a custom key for the tooltip label and name.
|
|
1061
|
+
|
|
1062
|
+
Chart comes with the `<ChartTooltip>` and `<ChartTooltipContent>` components. You can use these two components to add custom tooltips to your chart.
|
|
1063
|
+
|
|
1064
|
+
```tsx title="components/example-chart.tsx"
|
|
1065
|
+
import { ChartTooltip, ChartTooltipContent } from "@/components/ui/chart"
|
|
1066
|
+
```
|
|
1067
|
+
|
|
1068
|
+
```tsx title="components/example-chart.tsx"
|
|
1069
|
+
<ChartTooltip content={<ChartTooltipContent />} />
|
|
1070
|
+
```
|
|
1071
|
+
|
|
1072
|
+
### Props
|
|
1073
|
+
|
|
1074
|
+
Use the following props to customize the tooltip.
|
|
1075
|
+
|
|
1076
|
+
| Prop | Type | Description |
|
|
1077
|
+
| :-------------- | :----------------------- | :------------------------------------------- |
|
|
1078
|
+
| `labelKey` | string | The config or data key to use for the label. |
|
|
1079
|
+
| `nameKey` | string | The config or data key to use for the name. |
|
|
1080
|
+
| `indicator` | `dot` `line` or `dashed` | The indicator style for the tooltip. |
|
|
1081
|
+
| `hideLabel` | boolean | Whether to hide the label. |
|
|
1082
|
+
| `hideIndicator` | boolean | Whether to hide the indicator. |
|
|
1083
|
+
|
|
1084
|
+
### Colors
|
|
1085
|
+
|
|
1086
|
+
Colors are automatically referenced from the chart config.
|
|
1087
|
+
|
|
1088
|
+
### Custom
|
|
1089
|
+
|
|
1090
|
+
To use a custom key for tooltip label and names, use the `labelKey` and `nameKey` props.
|
|
1091
|
+
|
|
1092
|
+
```tsx showLineNumbers /browser/
|
|
1093
|
+
const chartData = [
|
|
1094
|
+
{ browser: "chrome", visitors: 187, fill: "var(--color-chrome)" },
|
|
1095
|
+
{ browser: "safari", visitors: 200, fill: "var(--color-safari)" },
|
|
1096
|
+
]
|
|
1097
|
+
|
|
1098
|
+
const chartConfig = {
|
|
1099
|
+
visitors: {
|
|
1100
|
+
label: "Total Visitors",
|
|
1101
|
+
},
|
|
1102
|
+
chrome: {
|
|
1103
|
+
label: "Chrome",
|
|
1104
|
+
color: "var(--chart-1)",
|
|
1105
|
+
},
|
|
1106
|
+
safari: {
|
|
1107
|
+
label: "Safari",
|
|
1108
|
+
color: "var(--chart-2)",
|
|
1109
|
+
},
|
|
1110
|
+
} satisfies ChartConfig
|
|
1111
|
+
```
|
|
1112
|
+
|
|
1113
|
+
```tsx title="components/example-chart.tsx"
|
|
1114
|
+
<ChartTooltip
|
|
1115
|
+
content={<ChartTooltipContent labelKey="visitors" nameKey="browser" />}
|
|
1116
|
+
/>
|
|
1117
|
+
```
|
|
1118
|
+
|
|
1119
|
+
This will use `Total Visitors` for label and `Chrome` and `Safari` for the tooltip names.
|
|
1120
|
+
|
|
1121
|
+
## Legend
|
|
1122
|
+
|
|
1123
|
+
You can use the custom `<ChartLegend>` and `<ChartLegendContent>` components to add a legend to your chart.
|
|
1124
|
+
|
|
1125
|
+
```tsx title="components/example-chart.tsx"
|
|
1126
|
+
import { ChartLegend, ChartLegendContent } from "@/components/ui/chart"
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
```tsx title="components/example-chart.tsx"
|
|
1130
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
1131
|
+
```
|
|
1132
|
+
|
|
1133
|
+
### Colors
|
|
1134
|
+
|
|
1135
|
+
Colors are automatically referenced from the chart config.
|
|
1136
|
+
|
|
1137
|
+
### Custom
|
|
1138
|
+
|
|
1139
|
+
To use a custom key for legend names, use the `nameKey` prop.
|
|
1140
|
+
|
|
1141
|
+
```tsx showLineNumbers /browser/
|
|
1142
|
+
const chartData = [
|
|
1143
|
+
{ browser: "chrome", visitors: 187, fill: "var(--color-chrome)" },
|
|
1144
|
+
{ browser: "safari", visitors: 200, fill: "var(--color-safari)" },
|
|
1145
|
+
]
|
|
1146
|
+
|
|
1147
|
+
const chartConfig = {
|
|
1148
|
+
chrome: {
|
|
1149
|
+
label: "Chrome",
|
|
1150
|
+
color: "var(--chart-1)",
|
|
1151
|
+
},
|
|
1152
|
+
safari: {
|
|
1153
|
+
label: "Safari",
|
|
1154
|
+
color: "var(--chart-2)",
|
|
1155
|
+
},
|
|
1156
|
+
} satisfies ChartConfig
|
|
1157
|
+
```
|
|
1158
|
+
|
|
1159
|
+
```tsx title="components/example-chart.tsx"
|
|
1160
|
+
<ChartLegend content={<ChartLegendContent nameKey="browser" />} />
|
|
1161
|
+
```
|
|
1162
|
+
|
|
1163
|
+
This will use `Chrome` and `Safari` for the legend names.
|
|
1164
|
+
|
|
1165
|
+
## Accessibility
|
|
1166
|
+
|
|
1167
|
+
You can turn on the `accessibilityLayer` prop to add an accessible layer to your chart.
|
|
1168
|
+
|
|
1169
|
+
This prop adds keyboard access and screen reader support to your charts.
|
|
1170
|
+
|
|
1171
|
+
```tsx title="components/example-chart.tsx"
|
|
1172
|
+
<LineChart accessibilityLayer />
|
|
1173
|
+
```
|
|
1174
|
+
|
|
1175
|
+
## RTL
|
|
1176
|
+
|
|
1177
|
+
To enable RTL support in shadcn/ui, see the [RTL configuration guide](/docs/rtl).
|
|
1178
|
+
|
|
1179
|
+
```tsx
|
|
1180
|
+
"use client"
|
|
1181
|
+
|
|
1182
|
+
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts"
|
|
1183
|
+
|
|
1184
|
+
import {
|
|
1185
|
+
useTranslation,
|
|
1186
|
+
type Translations,
|
|
1187
|
+
} from "@/components/language-selector"
|
|
1188
|
+
import {
|
|
1189
|
+
ChartContainer,
|
|
1190
|
+
ChartLegend,
|
|
1191
|
+
ChartLegendContent,
|
|
1192
|
+
ChartTooltip,
|
|
1193
|
+
ChartTooltipContent,
|
|
1194
|
+
type ChartConfig,
|
|
1195
|
+
} from "@/components/ui/chart"
|
|
1196
|
+
|
|
1197
|
+
const translations: Translations = {
|
|
1198
|
+
en: {
|
|
1199
|
+
dir: "ltr",
|
|
1200
|
+
values: {
|
|
1201
|
+
january: "January",
|
|
1202
|
+
february: "February",
|
|
1203
|
+
march: "March",
|
|
1204
|
+
april: "April",
|
|
1205
|
+
may: "May",
|
|
1206
|
+
june: "June",
|
|
1207
|
+
desktop: "Desktop",
|
|
1208
|
+
mobile: "Mobile",
|
|
1209
|
+
},
|
|
1210
|
+
},
|
|
1211
|
+
ar: {
|
|
1212
|
+
dir: "rtl",
|
|
1213
|
+
values: {
|
|
1214
|
+
january: "يناير",
|
|
1215
|
+
february: "فبراير",
|
|
1216
|
+
march: "مارس",
|
|
1217
|
+
april: "أبريل",
|
|
1218
|
+
may: "مايو",
|
|
1219
|
+
june: "يونيو",
|
|
1220
|
+
desktop: "سطح المكتب",
|
|
1221
|
+
mobile: "الجوال",
|
|
1222
|
+
},
|
|
1223
|
+
},
|
|
1224
|
+
he: {
|
|
1225
|
+
dir: "rtl",
|
|
1226
|
+
values: {
|
|
1227
|
+
january: "ינואר",
|
|
1228
|
+
february: "פברואר",
|
|
1229
|
+
march: "מרץ",
|
|
1230
|
+
april: "אפריל",
|
|
1231
|
+
may: "מאי",
|
|
1232
|
+
june: "יוני",
|
|
1233
|
+
desktop: "מחשב",
|
|
1234
|
+
mobile: "נייד",
|
|
1235
|
+
},
|
|
1236
|
+
},
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
const chartData = [
|
|
1240
|
+
{ month: "january", desktop: 186, mobile: 80 },
|
|
1241
|
+
{ month: "february", desktop: 305, mobile: 200 },
|
|
1242
|
+
{ month: "march", desktop: 237, mobile: 120 },
|
|
1243
|
+
{ month: "april", desktop: 73, mobile: 190 },
|
|
1244
|
+
{ month: "may", desktop: 209, mobile: 130 },
|
|
1245
|
+
{ month: "june", desktop: 214, mobile: 140 },
|
|
1246
|
+
]
|
|
1247
|
+
|
|
1248
|
+
export function ChartRtl() {
|
|
1249
|
+
const { t, dir } = useTranslation(translations, "ar")
|
|
1250
|
+
|
|
1251
|
+
const chartConfig = {
|
|
1252
|
+
desktop: {
|
|
1253
|
+
label: t.desktop,
|
|
1254
|
+
color: "var(--chart-2)",
|
|
1255
|
+
},
|
|
1256
|
+
mobile: {
|
|
1257
|
+
label: t.mobile,
|
|
1258
|
+
color: "var(--chart-1)",
|
|
1259
|
+
},
|
|
1260
|
+
} satisfies ChartConfig
|
|
1261
|
+
|
|
1262
|
+
return (
|
|
1263
|
+
<ChartContainer config={chartConfig} className="min-h-[200px] w-full">
|
|
1264
|
+
<BarChart accessibilityLayer data={chartData}>
|
|
1265
|
+
<CartesianGrid
|
|
1266
|
+
vertical={false}
|
|
1267
|
+
orientation={dir === "rtl" ? "right" : "left"}
|
|
1268
|
+
/>
|
|
1269
|
+
<XAxis
|
|
1270
|
+
dataKey="month"
|
|
1271
|
+
tickLine={false}
|
|
1272
|
+
tickMargin={10}
|
|
1273
|
+
axisLine={false}
|
|
1274
|
+
tickFormatter={(value) =>
|
|
1275
|
+
(t[value as keyof typeof t] as string).slice(0, 3)
|
|
1276
|
+
}
|
|
1277
|
+
reversed={dir === "rtl"}
|
|
1278
|
+
/>
|
|
1279
|
+
<ChartTooltip
|
|
1280
|
+
content={
|
|
1281
|
+
<ChartTooltipContent
|
|
1282
|
+
labelFormatter={(value) => t[value as keyof typeof t] as string}
|
|
1283
|
+
/>
|
|
1284
|
+
}
|
|
1285
|
+
labelClassName="w-32"
|
|
1286
|
+
/>
|
|
1287
|
+
<ChartLegend content={<ChartLegendContent />} />
|
|
1288
|
+
<Bar dataKey="desktop" fill="var(--color-desktop)" radius={4} />
|
|
1289
|
+
<Bar dataKey="mobile" fill="var(--color-mobile)" radius={4} />
|
|
1290
|
+
</BarChart>
|
|
1291
|
+
</ChartContainer>
|
|
1292
|
+
)
|
|
1293
|
+
}
|
|
1294
|
+
|
|
1295
|
+
```
|