psytask - v1.1.1
    Preparing search index...

    Function Select

    • Dropdown select component for choosing from predefined options

      Type Parameters

      • T extends string

      Parameters

      • props: BaseFieldProps<string> & { defaultValue?: T; options: SelectOption<(...)>[] }
        • OptionaldefaultValue?: T
        • options: SelectOption<(...)>[]

          Array of options to display in the dropdown

      Returns { node: HTMLDivElement; data: () => { value: string } }

      using difficultyField = app.scene(generic(Select), {
      defaultProps: {
      id: 'difficulty',
      label: 'Difficulty Level',
      defaultValue: 'medium',
      options: [
      { value: 'easy', label: 'Easy' },
      { value: 'medium', label: 'Medium' },
      { value: 'hard', label: 'Hard' },
      ],
      },
      });
      const data = await difficultyField.show();
      console.log(data.value); // 'easy' | 'medium' | 'hard'