Skip to content

Select

The FTSelect component replaces the standard html select with a design theme and a multitude of options.

Usage

Selects in their simplest form contain a list of options to choose from, and a search bar to filter them out.

Composition api (script setup)

vue
<script setup lang="ts">
  import { FTSelect } from '@fasttrack-solutions/vue-components-lib';
</script>
<script setup lang="ts">
  import { FTSelect } from '@fasttrack-solutions/vue-components-lib';
</script>

Options api

vue
<script>
  import { FTSelect } from '@fasttrack-solutions/vue-components-lib';
  export default {
    components: {
      FTSelect
    }
  }
</script>
<script>
  import { FTSelect } from '@fasttrack-solutions/vue-components-lib';
  export default {
    components: {
      FTSelect
    }
  }
</script>

Simple

INFO

Select an option

vue
<script setup lang="ts">
  import { ref } from 'vue';
  import { FTSelect } from '../components';

  const options = ref([]);
  
  for (let i = 1; i <= 20; i++) {
    options.value.push({ value: i, label: `Option ${i}`});
  }

  const model = ref(undefined);
</script>
<template>
  <FTSelect v-model="model" :options :showSearch="true" scrollableContainerSelector="body" placeholder="Select an option" mode="default" />
</template>
<script setup lang="ts">
  import { ref } from 'vue';
  import { FTSelect } from '../components';

  const options = ref([]);
  
  for (let i = 1; i <= 20; i++) {
    options.value.push({ value: i, label: `Option ${i}`});
  }

  const model = ref(undefined);
</script>
<template>
  <FTSelect v-model="model" :options :showSearch="true" scrollableContainerSelector="body" placeholder="Select an option" mode="default" />
</template>

Props

In order to modify the default behavior, FTSelect accepts custom helper props:

NameDefaultDescription
scrollableContainerSelector#activityPanelBodySelector for the scrollable container
modelValueundefinedSelected value(s) of the select field
modeundefinedSelect mode (single, multiple, etc.)
showSearchfalseEnable search inside the dropdown
boxedfalseDisplay as a boxed select
minifalseUse a smaller size variant
allowClearfalseAllow clearing the selection
isRequiredfalseMark the field as required
label''Label text for the select
disabledfalseDisable the select field
size'large'Size of the select (small, medium, large)
placeholder''Placeholder text
className''Additional CSS class for styling
focusBordertrueShow border on focus
autoFocusfalseAutomatically focus the select on mount
defaultOpenfalseOpen the dropdown by default
allowNewTagstrueAllow users to create new tags
iconBase64 IconCustom icon for the dropdown
loadingfalseShow loading state
filterOptionCustom FunctionFunction to filter options
options[]Array of selectable options
groupedOptions[]Array of grouped options
uppercaseTagstrueConvert tags to uppercase
tokenSeparators[', ', ' ']Characters that separate tokens in multi-mode
hideArrowfalseHide the dropdown arrow
id''Custom ID for the select element
errorMessage''Error message to display