Vue component to trap the focus within a DOM element

Overview

focus-trap-vue Build Status npm package thanks

Vue component to trap the focus within a DOM element

Installation

For Vue 2

npm install focus-trap focus-trap-vue

 For Vue 3

npm install focus-trap focus-trap-vue@next

Usage

This library exports one single named export FocusTrap and requires focus-trap as a peer dependency. So you can locally import the component or declare it globally:

 Register globally in a Vue 2 app

import { FocusTrap } from 'focus-trap-vue'

Vue.component('FocusTrap', FocusTrap)

 Register globally in a Vue 3 app

import { FocusTrap } from 'focus-trap-vue'

createApp(App)
  .component('FocusTrap', FocusTrap)
  .mount('#app)

Note this documentation is for Vue 3 and some props/events might not exist in the Vue 2 version

FocusTrap can be controlled in three different ways:

  • by using the active Boolean prop
  • by using v-model:active (uses the active prop, Vue 3 only)
  • by calling the activate/deactivate method on the component

The recommended approach is using v-model:active and it should contain one single child:

Do you accept the cookies?

">
<focus-trap v-model:active="isActive">
  <modal-dialog tabindex="-1">
    <p>
      Do you accept the cookies?
    p>
    <button @click="acceptCookies">Yesbutton>
    <button @click="isActive = false">Nobutton>
  modal-dialog>
focus-trap>

When isActive becomes true, it activates the focus trap. By default it sets the focus to its child, so make sure the element is a focusable element. If it's not you wil need to give it the tabindex="-1" attribute. You can also customize the initial element focused. This element should be an element that the user can interact with. For example, an input. It's a good practice to always focus an interactable element instead of the modal container:

What name do you want to use?

">
<focus-trap v-model:active="isActive" :initial-focus="() => $refs.nameInput">
  <modal-dialog>
    <p>
      What name do you want to use?
    p>
    <form @submit.prevent="setName">
      <label>
        New Name
        <input ref="nameInput" />
      label>
      <button>Change namebutton>
    form>
  modal-dialog>
focus-trap>

Props

FocusTrap also accepts other props:

  • escapeDeactivates: boolean
  • returnFocusOnDeactivate: boolean
  • allowOutsideClick: boolean | ((e: MouseEvent) => boolean)
  • clickOutsideDeactivates: boolean
  • initialFocus: string | (() => Element) Selector or function returning an Element
  • fallbackFocus: string | (() => Element) Selector or function returning an Element

Please, refer to focus-trap documentation to know what they do.

Events

FocusTrap emits 2 events. They are in-sync with the prop active

  • activate: Whenever the trap activates
  • deactivate: Whenever the trap deactivates (note it can also be deactivated by pressing Esc or clicking outside)

Methods

FocusTrap can be used without v-model:active. In that case, you will use the methods and probably need to initialize the trap as deactivated, otherwise, the focus will start as active:

$refs.focusTrap.activate()">Show the modal

Hello there!

">
<button @click="() => $refs.focusTrap.activate()">Show the modalbutton>

<focus-trap :active="false" ref="focusTrap">
  <modal-dialog>
    <p>Hello there!p>
    <button @click="() => $refs.focusTrap.deactivate()">Okay...button>
  modal-dialog>
focus-trap>

Note the use of arrow functions, this is necessary because we are accessing $refs which are unset on first render.

Related

License

MIT

This project was created using the Vue Library boilerplate by posva
Comments
  • Change active watcher flush for latest vue-next RC compliance

    Change active watcher flush for latest vue-next RC compliance

    As per https://github.com/vuejs/vue-next/commit/49bb44756fda0a7019c69f2fa6b880d9e41125aa watcher flush got changed. This library is affected, although not in all cases. I'll update the test cases soon to prove my point.

    opened by AlexandreBonaventure 13
  • WIP: Next

    WIP: Next

    What kind of change does this PR introduce? (check at least one)

    • [ ] Bugfix
    • [X] Feature
    • [ ] Code style update
    • [X] Refactor
    • [X] Build-related changes
    • [ ] Other, please describe:

    Does this PR introduce a breaking change? (check one)

    • [X] Yes
    • [ ] No

    If yes, please describe the impact and migration path for existing applications:

    The PR fulfills these requirements:

    • [ ] When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
    • [ ] All tests are passing
    • [ ] New/updated tests are included

    If adding a new feature, the PR's description includes:

    • [ ] A convincing reason for adding this feature (to avoid wasting your time, it's best to open a suggestion issue first and wait for approval before working on it)

    Other information:

    opened by AlexandreBonaventure 9
  • Vue 3 version

    Vue 3 version

    Hello 👋 For my own project I forked and upgraded this library with Vue 3 API. Would you be interested in joining our effort to merge these changes for a vue 3 compat ?

    looks roughly like that

    import { defineComponent, onMounted, watch, ref, cloneVNode, onUnmounted } from 'vue';
    import createFocusTrap, { FocusTrap as FocusTrapI } from 'focus-trap';
    
    const FocusTrap = defineComponent({
      props: {
        active: {
          // TODO: could be options for activate
          type: Boolean as () => boolean,
          default: true,
        },
        escapeDeactivates: {
          type: Boolean as () => boolean,
          default: true,
        },
        returnFocusOnDeactivate: {
          type: Boolean as () => boolean,
          default: true,
        },
        allowOutsideClick: {
          type: Boolean as () => boolean,
          default: true,
        },
        initialFocus: {
          type: [String as () => string, Function as () => () => HTMLElement],
          default: undefined,
        },
        fallbackFocus: {
          type: [String as () => string, Function as () => () => HTMLElement],
          default: undefined,
        },
      },
      setup (props, { slots, emit }) {
        let trap: FocusTrapI | null;
        const el = ref<HTMLElement | null>(null);
        onMounted(function () {
          watch(() => props.active, (active) => {
            if (active && el.value) {
              // has no effect if already activated
              trap = createFocusTrap(
                el.value,
                {
                  escapeDeactivates: props.escapeDeactivates,
                  allowOutsideClick: () => props.allowOutsideClick,
                  returnFocusOnDeactivate: props.returnFocusOnDeactivate,
                  onActivate: () => {
                    emit('update:active', true);
                    emit('activate');
                  },
                  onDeactivate: () => {
                    emit('update:active', false);
                    emit('deactivate');
                  },
                  initialFocus: typeof props.initialFocus === 'string' ? props.initialFocus : props.initialFocus?.() ?? el.value,
                  fallbackFocus: props.fallbackFocus,
                },
              );
              trap.activate();
            } else {
              trap?.deactivate();
            }
          },
          { immediate: true },
          );
        });
        onUnmounted(() => {
          trap?.deactivate();
          trap = null;
        });
        return () => {
          const content = slots.default?.();
          if (!content || !content.length || content.length > 1) { throw new Error('FocusTrap requires exactly one child'); };
          const vnode = cloneVNode(content[0], { ref: el });
          return vnode;
        };
      },
    });
    
    export { FocusTrap };
    
    ```
    opened by AlexandreBonaventure 5
  • fix(props): Upgrade `focus-trap` to fix `initialFocus` prop types

    fix(props): Upgrade `focus-trap` to fix `initialFocus` prop types

    The focus-trap library was updated in version 6.7.0 to fix an issue with the type used for the initialFocus option where passing false or a function that returns false was not allowed.

    The relevant release is tagged here: https://github.com/focus-trap/focus-trap/releases/tag/v6.7.0

    Updating the type to include the Boolean constructor will allow users of the Vue component to pass the false literal for the :initial-focus prop. A function returning false already passed the Vue type check but in previous versions of focus-trap would raise an error. This was also fixed in 6.7.0:

    https://github.com/focus-trap/focus-trap/commit/14b0ee830bd6d25fd86bac38135a590f98f43d25#diff-a3ce29c1c993dbf3f968461bb3ff5e3f522d8b0c94cc2ca8f6b3ef7a9eda3621R209-R212

    Updating the peer and dev dependencies to be at least 6.7.0 allows vue-focus-trap to have the correct behavior and types and to match the latest documentation for the focus-trap library.

    opened by sarayourfriend 4
  • fix: Pick underlying HTMLElement from Vue component Proxy (#385)

    fix: Pick underlying HTMLElement from Vue component Proxy (#385)

    This PR aims to fix the issue in #385 (and #380).

    As mentioned in #385, I'm not entirely sure if ComponentPublicInstance is the right type for arbitrary Vue components, and I am also rather unfamiliar with the internals of Vue, as I am mostly just a user of the framework.

    But the basic idea is that we should make sure that the underlying or rendered HTMLElement is passed to createFocusTrap instead of a Proxy of a Vue component.


    PR Summary

    What kind of change does this PR introduce? (check at least one)

    • [x] Bugfix

    Does this PR introduce a breaking change? (check one)

    • [x] No

    If yes, please describe the impact and migration path for existing applications:

    The PR fulfills these requirements:

    • [x] When resolving a specific issue, it's referenced in the PR's title (e.g. fix #xxx[,#xxx], where "xxx" is the issue number)
    • [x] All tests are passing
    • [x] New/updated tests are included

    PS: I've read the contribution guidelines but I still don't feel confident if what I'm doing is considered respectful or rude. Please feel free to point out if I'm doing something incorrectly.

    opened by japorized 4
  • el.querySelectorAll is not a function when el is a Vue component Proxy

    el.querySelectorAll is not a function when el is a Vue component Proxy

    Hello and thank you for working on this package. I noticed a potential bug related to #380. Here's a description of the issue.

    Context

    Whenever the focus trap becomes active, and the sole element in the focus trap is another Vue component (at least that seems to be the case), an error will be thrown in the console.

    Reproduction

    I've created a CodeSandbox instance where you can see the behavior for yourself.

    Steps to reproduce the behavior

    1. Click on the "Toggle trap focus" button
    2. See error

    Expected behavior

    Focus trap should kick in as the active prop is set to true.

    Actual behavior

    Received the following error when setting the active prop to true.

    index.js:25 Uncaught (in promise) TypeError: el.querySelectorAll is not a function
        at getCandidates2 (index.js:25)
        at tabbable2 (index.js:243)
        at index.js:226
        at Array.map (<anonymous>)
        at updateTabbableNodes2 (index.js:225)
        at Object.activate (index.js:546)
        at watch.immediate (focus-trap-vue.esm-bundler.js:80)
        at callWithErrorHandling (runtime-core.esm-bundler.js:154)
        at callWithAsyncErrorHandling (runtime-core.esm-bundler.js:163)
        at job (runtime-core.esm-bundler.js:2096)
    

    Additional information

    I first discovered this issue on Electron, and did a little debugging there to look at what el is. It turns out when the element inside of <focus-trap> is a Vue component, instead of an HTMLElement, a Proxy of the Vue component is passed.

    For clarity, I tried changing the element in the focus trap to a regular <div> and it worked as you'd expect.

    Nov 12th, 2021 Dug a bit deeper to understand a bit more about the dependencies here. The error is thrown from tabbable, which is a dependency of focus-trap, of which this library depends on. Looks like focus-trap is a expected to work in a framework-less scenario.

    A bit more digging shows that this library is using the as keyword in TypeScript on line 65 in the FocusTrap.ts file. Pasting that block here for context:

       const el = ref<HTMLElement | null>(null)
    
        const ensureTrap = () => {
          if (trap) {
            return
          }
    
          const { initialFocus } = props
          trap = createFocusTrap(el.value as HTMLElement, {
    

    I'm not familiar with Vue's API for plugins but if I understand it correctly, el is set during render, particularly on line 143 in the same file?

    Nov 13th, 2021 Cloned the repo to try see if I can figure something out.

    I'm away from my computer now, but when I tried earlier, I was able to "fix" the issue. I'm not sure if it's the right thing to do, however.

    First, I added the ComponentPublicInstance type (from vue) to the union for el.

    Then I added an extra check before createFocusTrap is called, like so

      if (
        !(el instanceof HTMLElement) &&
        Reflect.has(el.value, "$el")
      ) {
        el.value = (el.value as ComponentPublicInstance).$el;
      }
    
      trap = createFocusTrap(el.value as HTMLElement, {
    

    However, one thing that's notable is that $el has type any within ComponentPublicInstance, not HTMLElement. Hence why I'm not sure if this is a good solution.

    I'll likely check things out a bit further, get a bit more guarantee in before I make a PR.


    Related issues found: #380

    bug 
    opened by japorized 4
  • Enhancement - preventScroll option

    Enhancement - preventScroll option

    What problem is this solving

    Prevents scroll jumps when focusing both <focus-trap> target HTMLElement and returnFocusOnDeactivate target HTMLElement.

    Proposed solution

    Implement what original focus-trap library uses (preventScroll create option and tryFocus function):

    focus-trap's preventScroll create option

    focus-trap's tryFocus function

    We should have a tryFocus function called that passes preventScroll: true as FocusOptions in HTMLElement.focus(FocusOptions) method when focusing target HTMLElements.

    Describe alternatives you've considered

    There are ways to dodge scrolling issues, but it would require using position: fixed on target HTMLElements.

    feature request 
    opened by Delicious-Bacon 4
  • Vue3 compatible version no longer exports `activate` and `deactivate` methods

    Vue3 compatible version no longer exports `activate` and `deactivate` methods

    In the Vue2 version (1.x) the following was valid:

    <template>
      <FocusTrap ref="focusTrap">
        <!-- Content here -->
      </FocusTrap>
    </template>
    
    <script>
    export default {
      methods: {
        manuallyDeactivate() {
          this.$refs.focusTrap.deactivate()
        }
      }
    } 
    </script>
    

    The activate and deactivate methods were exposed on the component. The documentation speaks to their usage as well.

    This is no longer possible in the Vue3 (2.x / 3.x) version as the methods are not being exposed on the component.

    feature request 
    opened by DV8FromTheWorld 3
  • build(deps-dev): bump focus-trap from 5.1.0 to 6.0.1

    build(deps-dev): bump focus-trap from 5.1.0 to 6.0.1

    Bumps focus-trap from 5.1.0 to 6.0.1.

    Changelog

    Sourced from focus-trap's changelog.

    6.0.1

    Patch Changes

    • 694e2fa: Package main/module entries no longer point to minified bundles.

    6.0.0

    • Add boolean value support for allowOutsideClick option.
    • New preventScroll feature to prevent scrolling to the element getting focus if not in the viewport.
    • Changed code formatting to use dangling commas where ES5 supports them.
    • BREAKING: Updated tabbable dependency to the new 5.0.0 release which contains breaking changes to its isTabbableRadio() internal function.
    • Help with tree shaking by having package.json state sideEffects: false to mark this module as having no side effects as a result of merely importing it.
    • BREAKING: This package.json's "main" no longer points to ./index.js in the package (although it still points to a CJS module, so it's possible this actually doesn't break anything). It now has:
      • "main": dist/focus-trap.min.js (the CJS bundle)
      • "module": dist/focus-trap.esm.min.js (the new ESM bundle)
      • the UMD is dist/focus-trap.umd.min.js if needed (convenient for loading directly in an older browser that doesn't support ESM)
      • NOTE: The CJS build no longer provides a function as a default export. Use const { createFocusTrap } = require('focus-trap'); to get the function from before.
      • NOTE: The ESM build does not provide a default export. Use import { createFocusTrap } from 'focus-trap'; to import the module.
    • New ESM Build: Included in dist/focus-trap.esm.*.
    • New UMD Build: Included in dist/focus-trap.umd.*.
    Commits
    Maintainer changes

    This version was pushed to npm by stefcameron, a new releaser for focus-trap since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    opened by dependabot-preview[bot] 3
  • build(deps-dev): bump typescript from 3.7.5 to 4.0.2

    build(deps-dev): bump typescript from 3.7.5 to 4.0.2

    Bumps typescript from 3.7.5 to 4.0.2.

    Release notes

    Sourced from typescript's releases.

    TypeScript 4.0

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    Downloads are available on:

    TypeScript 4.0 Beta

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    Downloads are available on:

    TypeScript 3.9.7

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    (note, 3.9.4 was intentionally skipped due to minor complications in publishing)

    Downloads are available on:

    TypeScript 3.9.6

    For release notes, check out the release announcement.

    Commits
    Maintainer changes

    This version was pushed to npm by typescript-bot, a new releaser for typescript since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    opened by dependabot-preview[bot] 3
  • build(deps-dev): bump typescript from 3.7.5 to 3.9.6

    build(deps-dev): bump typescript from 3.7.5 to 3.9.6

    Bumps typescript from 3.7.5 to 3.9.6.

    Release notes

    Sourced from typescript's releases.

    TypeScript 3.9.5

    This release contains bug fixes in type-checking, emit, and editor scenarios.

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    (note, 3.9.4 was intentionally skipped due to minor complications in publishing)

    Downloads are available on:

    TypeScript 3.9.3

    This release contains bug fixes in type-checking, APIs, emit, and editor scenarios.

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    Downloads are available on:

    TypeScript 3.9.2

    For release notes, check out the release announcement.

    For the complete list of fixed issues, check out the

    Downloads are available on:

    TypeScript 3.9 RC

    For release notes, check out the release announcement.

    Commits
    Maintainer changes

    This version was pushed to npm by typescript-bot, a new releaser for typescript since your current version.


    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.

    If all status checks pass Dependabot will automatically merge this pull request.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    • @dependabot use these labels will set the current labels as the default for future PRs for this repo and language
    • @dependabot use these reviewers will set the current reviewers as the default for future PRs for this repo and language
    • @dependabot use these assignees will set the current assignees as the default for future PRs for this repo and language
    • @dependabot use this milestone will set the current milestone as the default for future PRs for this repo and language
    • @dependabot badge me will comment on this PR with code to add a "Dependabot enabled" badge to your readme

    Additionally, you can set the following in your Dependabot dashboard:

    • Update frequency (including time of day and day of week)
    • Pull request limits (per update run and/or open at any time)
    • Automerge options (never/patch/minor, and dev/runtime dependencies)
    • Out-of-range updates (receive only lockfile updates, if desired)
    • Security updates (receive only security updates, if desired)
    opened by dependabot-preview[bot] 3
Releases(v4.0.1)
Owner
Eduardo San Martin Morote
Member of the @vuejs core team Speaker, trainer. From 🇪🇸, lives in 🇫🇷
Eduardo San Martin Morote
Enable tap, swipe, touch, hold, mouse down, mouse up events on any HTML DOM Element in vue.js 3.x.

vue3-touch-events Enable tap, swipe, touch, hold, mouse down, mouse up events on any HTML DOM Element in vue.js 3.x. The easiest way to make your inte

Robin Rodricks 108 Dec 27, 2022
Detect DOM element resizing based on Vue3.x

Detect DOM element resizing based on Vue3.x

null 0 Jul 22, 2021
Convert HTML DOM Element to PDF

Convert HTML DOM Element to PDF. You can save a specified element as PDF File, print it directly, or preview as PDF.

Emily Wang 0 Jul 29, 2019
🖍 Vue component to highlight words within a larger body of text.

vue-highlight-words A simple port from react-highlight-words Vue component to highlight words within a larger body of text. demo Why? It uses render t

Yichang Liu 58 Oct 27, 2022
React component to highlight words within a larger body of text

React component to highlight words within a larger body of text. Check out a demo here. Usage To use it, just provide it with an array of search terms

Brian Vaughn 1.8k Dec 28, 2022
Keep yourself in the zone and focus in the moment.

Zen. is a productivity app that integrates Eisenhower Matrix, Pomodoros, and part of the Get Things Done (GTD) principles in a unique way, to improve your developer routine. The purpose of Zen is to help you staying in the zone.

Jesus Guerrero 19 Dec 1, 2022
Polyfill for `:focus-visible`

Based on the proposed CSS :focus-visible pseudo-selector, this prototype adds a focus-visible class to the focused element, in situations in which the

Web Incubator CG 1.6k Jan 3, 2023
Content-theme-blog-minimal is a standalone theme for creating your blog within minutes!

content-theme-blog-minimal content-theme-blog-minimal is a standalone theme for creating your blog within minutes! Demo: https://dumptyd.github.io/con

Saad 12 Aug 28, 2022
A Vue.js 2 component to clone DOM elements

vue-cloneya A vue component to clone DOM elements Live demo here Install yarn add vue-cloneya # or npm i vue-cloneya Import import Vue from 'vue'

Rida Amirini 15 Aug 27, 2022
An escape hatch for DOM Elements in Vue.js components.

vue-dom-portal An escape hatch for DOM Elements in Vue.js components. The directive v-dom-portal will move DOM Nodes from their current place in a Vue

Caleb Roseland 202 Nov 2, 2022
A vue directive to keep dom ratio

vue-keep-ratio [中文项目介绍] As there comes a new css attribute: aspect-ratio, I picked up my old work vue-keep-ratio, use a more adaptive (but hack) way t

Aiello 6 Sep 13, 2021
A directive-supported plugin for transfering DOM to another location in Vue.js components

A directive-supported plugin for transfering DOM to another location in Vue.js components

Emil Zhai 1 Jul 13, 2019
BEM is a great way to namespace DOM elements

Vue BEM Plugin BEM is a great way to namespace DOM elements. If you're like me, however, you can't stand manually writing __ and -- over and over agai

Mike Schutte 0 Apr 6, 2019
A Vue.js plugin that affixes an element on the window while scrolling based on a relative element

Affixes an element on the screen based on a relative element Unlike other plugins, this Vue 2 component will make it easy to affix any element while s

Mauricio Farias Dziedzinski 403 Dec 2, 2022
Cron Generator Implemented by Vue.js and Element-ui(基于Vue&Element-UI构建的在线Cron表达式生成器)

vue-cron-generator a project using vue,element-ui to generate cron expression 中文 Online demo Used by ?? Attemper: A distributed,multi-tenancy,job-flow

党羚(ldang) 92 Dec 12, 2022
A Component Library based on Element-UI.

y-components 说明 基于 element-ui 的组件库 文档 https://yp910108.github.io/y-components 安装 # y-components 依赖于 element-ui,首先安装 element-ui npm i [email protected]

null 2 Sep 23, 2022
Vue.js (2+) directive that clamps the content of an element by adding an ellipsis to it if the content inside is too long.

vue-clampy Vue.js (2+) directive that clamps the content of an element by adding an ellipsis to it if the content inside is too long. It uses @clampy-

null 81 Jul 30, 2022
A Vue.js directive for animating an element from height: auto; to height: 0px; and vice-versa.

v-show-slide A Vue.js directive for animating an element from height: auto to height: 0px and vice-versa. ?? 3kb (1kb gzipped) ?? No dependencies ?? T

Pete Hegman 104 Nov 24, 2022
A vue directive which automatically resize font size based on element width.

Vue Resize Text A vue directive which automatically resize font size based on element width. It makes the font-size flexible on fluid or responsive la

Jayesh Vachhani 66 Oct 20, 2022