Welcome to mirror list, hosted at ThFree Co, Russian Federation.

segmented_control_button_group.vue « components « vue_shared « javascripts « assets « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: f50706b6de89c8101912d64f1d68178a7e64c9e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<script>
import { GlButtonGroup, GlButton } from '@gitlab/ui';

// TODO: We're planning to move this component to GitLab UI
//       https://gitlab.com/gitlab-org/gitlab-ui/-/issues/1787
export default {
  components: {
    GlButtonGroup,
    GlButton,
  },
  props: {
    options: {
      type: Array,
      required: true,
    },
    value: {
      type: [String, Number, Boolean],
      required: true,
    },
  },
};
</script>
<template>
  <gl-button-group>
    <gl-button
      v-for="opt in options"
      :key="opt.value"
      :disabled="!!opt.disabled"
      :selected="value === opt.value"
      @click="$emit('input', opt.value)"
    >
      <slot name="button-content" v-bind="opt">{{ opt.text }}</slot>
    </gl-button>
  </gl-button-group>
</template>