Component() — ui Function Reference
Architecture documentation for the Component() function in chart-area-interactive.tsx from the ui codebase.
Entity Profile
Dependency Diagram
graph TD 8f381913_dd1f_f239_50da_c95fca171e73["Component()"] 7b2cd38e_ea46_8f10_437b_b59abb8d9074["chart-area-interactive.tsx"] 8f381913_dd1f_f239_50da_c95fca171e73 -->|defined in| 7b2cd38e_ea46_8f10_437b_b59abb8d9074 style 8f381913_dd1f_f239_50da_c95fca171e73 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
deprecated/www/__registry__/new-york/charts/chart-area-interactive.tsx lines 139–266
export default function Component() {
const [timeRange, setTimeRange] = React.useState("90d")
const filteredData = chartData.filter((item) => {
const date = new Date(item.date)
const referenceDate = new Date("2024-06-30")
let daysToSubtract = 90
if (timeRange === "30d") {
daysToSubtract = 30
} else if (timeRange === "7d") {
daysToSubtract = 7
}
const startDate = new Date(referenceDate)
startDate.setDate(startDate.getDate() - daysToSubtract)
return date >= startDate
})
return (
<Card>
<CardHeader className="flex items-center gap-2 space-y-0 border-b py-5 sm:flex-row">
<div className="grid flex-1 gap-1 text-center sm:text-left">
<CardTitle>Area Chart - Interactive</CardTitle>
<CardDescription>
Showing total visitors for the last 3 months
</CardDescription>
</div>
<Select value={timeRange} onValueChange={setTimeRange}>
<SelectTrigger
className="w-[160px] rounded-lg sm:ml-auto"
aria-label="Select a value"
>
<SelectValue placeholder="Last 3 months" />
</SelectTrigger>
<SelectContent className="rounded-xl">
<SelectItem value="90d" className="rounded-lg">
Last 3 months
</SelectItem>
<SelectItem value="30d" className="rounded-lg">
Last 30 days
</SelectItem>
<SelectItem value="7d" className="rounded-lg">
Last 7 days
</SelectItem>
</SelectContent>
</Select>
</CardHeader>
<CardContent className="px-2 pt-4 sm:px-6 sm:pt-6">
<ChartContainer
config={chartConfig}
className="aspect-auto h-[250px] w-full"
>
<AreaChart data={filteredData}>
<defs>
<linearGradient id="fillDesktop" x1="0" y1="0" x2="0" y2="1">
<stop
offset="5%"
stopColor="var(--color-desktop)"
stopOpacity={0.8}
/>
<stop
offset="95%"
stopColor="var(--color-desktop)"
stopOpacity={0.1}
/>
</linearGradient>
<linearGradient id="fillMobile" x1="0" y1="0" x2="0" y2="1">
<stop
offset="5%"
stopColor="var(--color-mobile)"
stopOpacity={0.8}
/>
<stop
offset="95%"
stopColor="var(--color-mobile)"
stopOpacity={0.1}
/>
</linearGradient>
</defs>
<CartesianGrid vertical={false} />
<XAxis
dataKey="date"
Domain
Subdomains
Source
Frequently Asked Questions
What does Component() do?
Component() is a function in the ui codebase, defined in deprecated/www/__registry__/new-york/charts/chart-area-interactive.tsx.
Where is Component() defined?
Component() is defined in deprecated/www/__registry__/new-york/charts/chart-area-interactive.tsx at line 139.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free