Home / Function/ FontPicker() — ui Function Reference

FontPicker() — ui Function Reference

Architecture documentation for the FontPicker() function in font-picker.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  a65cd8b2_9054_cd5c_f5ae_4fb813cde357["FontPicker()"]
  f1ad163c_2e56_1e83_5772_da63039f5347["font-picker.tsx"]
  a65cd8b2_9054_cd5c_f5ae_4fb813cde357 -->|defined in| f1ad163c_2e56_1e83_5772_da63039f5347
  style a65cd8b2_9054_cd5c_f5ae_4fb813cde357 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/v4/app/(create)/components/font-picker.tsx lines 25–103

export function FontPicker({
  fonts,
  isMobile,
  anchorRef,
}: {
  fonts: readonly Font[]
  isMobile: boolean
  anchorRef: React.RefObject<HTMLDivElement | null>
}) {
  const [params, setParams] = useDesignSystemSearchParams()

  const currentFont = React.useMemo(
    () => fonts.find((font) => font.value === params.font),
    [fonts, params.font]
  )

  return (
    <div className="group/picker relative">
      <Picker>
        <PickerTrigger>
          <div className="flex flex-col justify-start text-left">
            <div className="text-muted-foreground text-xs">Font</div>
            <div className="text-foreground text-sm font-medium">
              {currentFont?.name}
            </div>
          </div>
          <div
            className="text-foreground pointer-events-none absolute top-1/2 right-4 flex size-4 -translate-y-1/2 items-center justify-center text-base select-none"
            style={{ fontFamily: currentFont?.font.style.fontFamily }}
          >
            Aa
          </div>
        </PickerTrigger>
        <PickerContent
          anchor={isMobile ? anchorRef : undefined}
          side={isMobile ? "top" : "right"}
          align={isMobile ? "center" : "start"}
          className="max-h-96 md:w-72"
        >
          <PickerRadioGroup
            value={currentFont?.value}
            onValueChange={(value) => {
              setParams({ font: value as FontValue })
            }}
          >
            <PickerGroup>
              {fonts.map((font, index) => (
                <React.Fragment key={font.value}>
                  <PickerRadioItem value={font.value}>
                    <Item size="xs">
                      <ItemContent className="gap-1">
                        <ItemTitle className="text-muted-foreground text-xs font-medium">
                          {font.name}
                        </ItemTitle>
                        <ItemDescription
                          style={{ fontFamily: font.font.style.fontFamily }}
                        >
                          Designers love packing quirky glyphs into test
                          phrases.
                        </ItemDescription>
                      </ItemContent>
                    </Item>
                  </PickerRadioItem>
                  {index < fonts.length - 1 && (
                    <PickerSeparator className="opacity-50" />
                  )}
                </React.Fragment>
              ))}
            </PickerGroup>
          </PickerRadioGroup>
        </PickerContent>
      </Picker>
      <LockButton
        param="font"
        className="absolute top-1/2 right-10 -translate-y-1/2"
      />
    </div>
  )
}

Domain

Subdomains

Frequently Asked Questions

What does FontPicker() do?
FontPicker() is a function in the ui codebase, defined in apps/v4/app/(create)/components/font-picker.tsx.
Where is FontPicker() defined?
FontPicker() is defined in apps/v4/app/(create)/components/font-picker.tsx at line 25.

Analyze Your Own Codebase

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

Try Supermodel Free