Avataaars API Documentation - v3.1.0
    Preparing search index...

    Function Selector

    • Selector component for option-based rendering.

      This component selects and renders a child component based on the current option value in the OptionContext. It automatically registers available options from its children and selects the matching one.

      Parameters

      • props: SelectorProps

        Selector configuration

        Props for the Selector component.

        • Readonlyoption: Option

          The option definition to select based on

        • ReadonlydefaultOption: string | ComponentType

          Default component or value to use

        • Optional Readonlychildren?: ReactNode

          Child components, each representing an option value

      Returns Element | null

      The selected child component or null

      <Selector option={TopOption} defaultOption={LongHairStraight}>
      <NoHair />
      <LongHairStraight />
      <LongHairCurly />
      </Selector>