primevue-mirror/doc/focustrap/BasicDoc.vue

133 lines
4.4 KiB
Vue
Raw Normal View History

2023-02-28 08:29:30 +00:00
<template>
<DocSectionText v-bind="$attrs">
2023-06-13 08:10:31 +00:00
<p>FocusTrap is enabled by attaching the directive with the v- prefix.</p>
2023-02-28 08:29:30 +00:00
</DocSectionText>
2023-10-23 21:04:45 +00:00
<div class="card flex justify-content-center p-fluid">
<div v-focustrap class="w-full" style="max-width: 20rem">
2023-02-28 08:29:30 +00:00
<div class="field">
2023-10-23 21:04:45 +00:00
<div class="p-input-icon-right">
<i class="pi pi-user" />
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div>
2023-02-28 08:29:30 +00:00
</div>
<div class="field">
<div class="p-input-icon-right">
<i class="pi pi-envelope" />
<InputText id="email" v-model="email" type="email" placeholder="Email" />
</div>
</div>
<div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
2023-10-23 21:04:45 +00:00
<label for="accept">I agree to the terms and conditions.</label>
2023-02-28 08:29:30 +00:00
</div>
<Button type="submit" label="Submit" class="mt-2" />
</div>
</div>
<DocSectionCode :code="code" />
</template>
<script>
export default {
data() {
return {
name: null,
email: null,
2023-10-23 21:04:45 +00:00
accept: false,
2023-02-28 08:29:30 +00:00
code: {
2023-09-22 12:54:14 +00:00
basic: `
2023-10-23 21:04:45 +00:00
<div v-focustrap class="w-full" style="max-width: 20rem">
<div class="field">
<div class="p-input-icon-right">
<i class="pi pi-user" />
2023-02-28 08:29:30 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div>
2023-10-23 21:04:45 +00:00
</div>
<div class="field">
<div class="p-input-icon-right">
<i class="pi pi-envelope" />
<InputText id="email" v-model="email" type="email" placeholder="Email" />
2023-02-28 08:29:30 +00:00
</div>
</div>
2023-10-23 21:04:45 +00:00
<div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
<label for="accept">I agree to the terms and conditions.</label>
</div>
<Button type="submit" label="Submit" class="mt-2" />
2023-10-15 09:38:39 +00:00
</div>
`,
2023-09-22 12:54:14 +00:00
options: `
<template>
2023-10-23 21:04:45 +00:00
<div class="card flex justify-content-center p-fluid">
<div v-focustrap class="w-full" style="max-width: 20rem">
2023-02-28 08:29:30 +00:00
<div class="field">
2023-10-23 21:04:45 +00:00
<div class="p-input-icon-right">
<i class="pi pi-user" />
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div>
2023-02-28 08:29:30 +00:00
</div>
<div class="field">
<div class="p-input-icon-right">
<i class="pi pi-envelope" />
<InputText id="email" v-model="email" type="email" placeholder="Email" />
</div>
</div>
<div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
2023-10-23 21:04:45 +00:00
<label for="accept">I agree to the terms and conditions.</label>
2023-02-28 08:29:30 +00:00
</div>
<Button type="submit" label="Submit" class="mt-2" />
</div>
</div>
</template>
<script>
export default {
data() {
return {
name: null,
email: null,
2023-10-23 21:04:45 +00:00
accept: false
2023-02-28 08:29:30 +00:00
};
}
};
2023-10-15 09:38:39 +00:00
<\/script>
`,
2023-09-22 12:54:14 +00:00
composition: `
<template>
2023-10-23 21:04:45 +00:00
<div class="card flex justify-content-center p-fluid">
<div v-focustrap class="w-full" style="max-width: 20rem">
2023-02-28 08:29:30 +00:00
<div class="field">
2023-10-23 21:04:45 +00:00
<div class="p-input-icon-right">
<i class="pi pi-user" />
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
</div>
2023-02-28 08:29:30 +00:00
</div>
<div class="field">
<div class="p-input-icon-right">
<i class="pi pi-envelope" />
<InputText id="email" v-model="email" type="email" placeholder="Email" />
</div>
</div>
<div class="field-checkbox">
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
2023-10-23 21:04:45 +00:00
<label for="accept">I agree to the terms and conditions.</label>
2023-02-28 08:29:30 +00:00
</div>
<Button type="submit" label="Submit" class="mt-2" />
</div>
</div>
</template>
<script setup>
import { ref } from 'vue';
const name = ref();
const email = ref();
2023-10-23 21:04:45 +00:00
const accept = ref(false);
2023-10-15 09:38:39 +00:00
<\/script>
`
2023-02-28 08:29:30 +00:00
}
};
}
};
</script>