primevue-mirror/doc/inputgroup/CheckboxDoc.vue

152 lines
4.4 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>
<div class="card flex flex-column md:flex-row gap-3">
<div class="p-inputgroup flex-1">
<InputText placeholder="Price" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</span>
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked1" :binary="true" />
</span>
<InputText placeholder="Username" />
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked2" :binary="true" />
</span>
<InputText placeholder="Website" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</span>
</div>
</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: `
<div class="p-inputgroup flex-1">
2023-02-28 08:29:30 +00:00
<InputText placeholder="Price" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</span>
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked1" :binary="true" />
</span>
<InputText placeholder="Username" />
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked2" :binary="true" />
</span>
<InputText placeholder="Website" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</span>
2023-10-15 09:38:39 +00:00
</div>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-02-28 08:29:30 +00:00
<div class="card flex flex-column md:flex-row gap-3">
<div class="p-inputgroup flex-1">
<InputText placeholder="Price" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</span>
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked1" :binary="true" />
</span>
<InputText placeholder="Username" />
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked2" :binary="true" />
</span>
<InputText placeholder="Website" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</span>
</div>
</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>
2023-02-28 08:29:30 +00:00
<div class="card flex flex-column md:flex-row gap-3">
<div class="p-inputgroup flex-1">
<InputText placeholder="Price" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue1" name="rb1" value="rb1" />
</span>
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked1" :binary="true" />
</span>
<InputText placeholder="Username" />
</div>
<div class="p-inputgroup flex-1">
<span class="p-inputgroup-addon">
<Checkbox v-model="checked2" :binary="true" />
</span>
<InputText placeholder="Website" />
<span class="p-inputgroup-addon">
<RadioButton v-model="radioValue2" name="rb2" value="rb2" />
</span>
</div>
</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>