primevue-mirror/apps/showcase/doc/inputgroup/CheckboxDoc.vue

152 lines
4.1 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
<p>Checkbox and RadioButton components can be combined with an input element under the same group.</p>
</DocSectionText>
2024-05-20 12:14:38 +00:00
<div class="card flex flex-col md:flex-row gap-4">
<InputGroup>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Price" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</InputGroupAddon>
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked1" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Username" />
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked2" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Website" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</InputGroupAddon>
</InputGroup>
2023-02-28 08:29:30 +00:00
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
checked1: false,
checked2: false,
radioValue1: '',
radioValue2: '',
code: {
2023-09-22 12:54:14 +00:00
basic: `
<InputGroup>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Price" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</InputGroupAddon>
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked1" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Username" />
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked2" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Website" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</InputGroupAddon>
</InputGroup>
2023-10-15 09:38:39 +00:00
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex flex-col md:flex-row gap-4">
<InputGroup>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Price" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</InputGroupAddon>
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked1" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Username" />
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked2" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Website" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</InputGroupAddon>
</InputGroup>
2023-02-28 08:29:30 +00:00
</div>
</template>
<script>
export default {
data() {
return {
checked1: false,
checked2: false,
radioValue1: '',
radioValue2: ''
};
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2024-05-20 12:14:38 +00:00
<div class="card flex flex-col md:flex-row gap-4">
<InputGroup>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Price" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</InputGroupAddon>
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked1" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Username" />
</InputGroup>
2023-02-28 08:29:30 +00:00
<InputGroup>
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<Checkbox v-model="checked2" :binary="true" />
</InputGroupAddon>
2023-02-28 08:29:30 +00:00
<InputText placeholder="Website" />
<InputGroupAddon>
2023-02-28 08:29:30 +00:00
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</InputGroupAddon>
</InputGroup>
2023-02-28 08:29:30 +00:00
</div>
</template>
<script setup>
import { ref } from "vue";
const checked1 = ref(false);
const checked2 = ref(false);
const radioValue1 = ref('');
const radioValue2 = ref('');
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>