primevue-mirror/apps/showcase/doc/focustrap/BasicDoc.vue

145 lines
4.3 KiB
Vue
Raw Permalink 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>
2024-07-02 10:05:17 +00:00
<div class="card flex justify-center">
2024-05-24 06:54:18 +00:00
<div v-focustrap class="w-full sm:w-80 flex flex-col gap-6">
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<div class="flex items-center gap-2">
2023-02-28 08:29:30 +00:00
<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>
2024-05-24 06:54:18 +00:00
2023-02-28 08:29:30 +00:00
<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: `
2024-05-24 06:54:18 +00:00
<div v-focustrap class="w-full sm:w-80 flex flex-col gap-6">
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<div class="flex items-center gap-2">
2023-10-23 21:04:45 +00:00
<Checkbox id="accept" v-model="accept" name="accept" value="Accept" />
<label for="accept">I agree to the terms and conditions.</label>
</div>
2024-05-24 06:54:18 +00:00
2023-10-23 21:04:45 +00:00
<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>
2024-07-02 10:05:17 +00:00
<div class="card flex justify-center">
2024-05-24 06:54:18 +00:00
<div v-focustrap class="w-full sm:w-80 flex flex-col gap-6">
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<div class="flex items-center gap-2">
2023-02-28 08:29:30 +00:00
<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>
2024-05-24 06:54:18 +00:00
2023-02-28 08:29:30 +00:00
<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>
2024-07-02 10:05:17 +00:00
<div class="card flex justify-center">
2024-05-24 06:54:18 +00:00
<div v-focustrap class="w-full sm:w-80 flex flex-col gap-6">
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2024-07-02 10:05:17 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" fluid />
2024-05-24 06:54:18 +00:00
</IconField>
<div class="flex items-center gap-2">
2023-02-28 08:29:30 +00:00
<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>
2024-05-24 06:54:18 +00:00
2023-02-28 08:29:30 +00:00
<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>