primevue-mirror/doc/focustrap/BasicDoc.vue

149 lines
4.8 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>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center p-fluid">
2023-10-23 21:04:45 +00:00
<div v-focustrap class="w-full" style="max-width: 20rem">
2023-02-28 08:29:30 +00:00
<div class="field">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2023-10-23 21:04:45 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
2024-01-30 08:04:48 +00:00
</IconField>
2023-02-28 08:29:30 +00:00
</div>
<div class="field">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2023-02-28 08:29:30 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" />
2024-01-30 08:04:48 +00:00
</IconField>
2023-02-28 08:29:30 +00:00
</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">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2023-02-28 08:29:30 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
2024-01-30 08:04:48 +00:00
</IconField>
2023-10-23 21:04:45 +00:00
</div>
<div class="field">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2023-10-23 21:04:45 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" />
2024-01-30 08:04:48 +00:00
</IconField>
2023-02-28 08:29:30 +00:00
</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>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center p-fluid">
2023-10-23 21:04:45 +00:00
<div v-focustrap class="w-full" style="max-width: 20rem">
2023-02-28 08:29:30 +00:00
<div class="field">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2023-10-23 21:04:45 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
2024-01-30 08:04:48 +00:00
</IconField>
2023-02-28 08:29:30 +00:00
</div>
<div class="field">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2023-02-28 08:29:30 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" />
2024-01-30 08:04:48 +00:00
</IconField>
2023-02-28 08:29:30 +00:00
</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>
2024-05-20 12:14:38 +00:00
<div class="card flex justify-center p-fluid">
2023-10-23 21:04:45 +00:00
<div v-focustrap class="w-full" style="max-width: 20rem">
2023-02-28 08:29:30 +00:00
<div class="field">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-user" />
</InputIcon>
2023-10-23 21:04:45 +00:00
<InputText id="input" v-model="name" type="text" placeholder="Name" autofocus />
2024-01-30 08:04:48 +00:00
</IconField>
2023-02-28 08:29:30 +00:00
</div>
<div class="field">
2024-01-30 08:04:48 +00:00
<IconField>
<InputIcon>
<i class="pi pi-envelope" />
</InputIcon>
2023-02-28 08:29:30 +00:00
<InputText id="email" v-model="email" type="email" placeholder="Email" />
2024-01-30 08:04:48 +00:00
</IconField>
2023-02-28 08:29:30 +00:00
</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>