Home / Function/ DrawerRtl() — ui Function Reference

DrawerRtl() — ui Function Reference

Architecture documentation for the DrawerRtl() function in drawer-rtl.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  527aa412_395a_35bd_0c86_09e181fb5972["DrawerRtl()"]
  dafcd16b_340d_1b00_8d70_1cb0edbc0340["drawer-rtl.tsx"]
  527aa412_395a_35bd_0c86_09e181fb5972 -->|defined in| dafcd16b_340d_1b00_8d70_1cb0edbc0340
  style 527aa412_395a_35bd_0c86_09e181fb5972 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/examples/base/drawer-rtl.tsx lines 110–193

export function DrawerRtl() {
  const { dir, locale, language, t } = useTranslation(translations, "ar")
  const [goal, setGoal] = React.useState(350)

  function onClick(adjustment: number) {
    setGoal(Math.max(200, Math.min(400, goal + adjustment)))
  }

  return (
    <Drawer>
      <DrawerTrigger asChild>
        <Button variant="outline">{t.trigger}</Button>
      </DrawerTrigger>
      <DrawerContent dir={dir} data-lang={dir === "rtl" ? language : undefined}>
        <div className="mx-auto w-full max-w-sm">
          <DrawerHeader>
            <DrawerTitle>{t.title}</DrawerTitle>
            <DrawerDescription>{t.description}</DrawerDescription>
          </DrawerHeader>
          <div className="p-4 pb-0">
            <div className="flex items-center justify-center space-x-2">
              <Button
                variant="outline"
                size="icon"
                className="h-8 w-8 shrink-0 rounded-full"
                onClick={() => onClick(-10)}
                disabled={goal <= 200}
              >
                <Minus />
                <span className="sr-only">{t.decrease}</span>
              </Button>
              <div className="flex-1 text-center">
                <div className="text-7xl font-bold tracking-tighter">
                  {goal.toLocaleString(locale)}
                </div>
                <div className="text-muted-foreground text-[0.70rem] uppercase">
                  {t.caloriesPerDay}
                </div>
              </div>
              <Button
                variant="outline"
                size="icon"
                className="h-8 w-8 shrink-0 rounded-full"
                onClick={() => onClick(10)}
                disabled={goal >= 400}
              >
                <Plus />
                <span className="sr-only">{t.increase}</span>
              </Button>
            </div>
            <div className="mt-3 h-[120px]">
              <ResponsiveContainer width="100%" height="100%">
                <BarChart data={data}>
                  <XAxis
                    dataKey="goal"
                    tickLine={false}
                    tickMargin={10}
                    axisLine={false}
                    tickFormatter={(value) => value.toLocaleString(locale)}
                    reversed={dir === "rtl"}
                  />
                  <Bar
                    dataKey="goal"
                    style={
                      {
                        fill: "var(--chart-2)",
                      } as React.CSSProperties
                    }
                  />
                </BarChart>
              </ResponsiveContainer>
            </div>
          </div>
          <DrawerFooter>
            <Button>{t.submit}</Button>
            <DrawerClose asChild>
              <Button variant="outline">{t.cancel}</Button>
            </DrawerClose>
          </DrawerFooter>
        </div>
      </DrawerContent>

Subdomains

Frequently Asked Questions

What does DrawerRtl() do?
DrawerRtl() is a function in the ui codebase, defined in apps/v4/examples/base/drawer-rtl.tsx.
Where is DrawerRtl() defined?
DrawerRtl() is defined in apps/v4/examples/base/drawer-rtl.tsx at line 110.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free