{"_id":"@cypress-design/vue-textbox","name":"@cypress-design/vue-textbox","dist-tags":{"latest":"1.0.1"},"versions":{"1.0.1":{"name":"@cypress-design/vue-textbox","version":"1.0.1","typings":"./dist/index.d.ts","main":"./dist/index.umd.js","module":"./dist/index.es.mjs","exports":{".":{"import":"./dist/index.es.mjs","require":"./dist/index.umd.js","types":"./dist/index.d.ts"}},"scripts":{"build":"yarn build:module && yarn build:types","build:module":"yarn vite build","build:types":"yarn vue-tsc --project ./tsconfig.build.json"},"devDependencies":{"@cypress-design/constants-textbox":"*","@cypress-design/rollup-plugin-tailwind-keep":"*"},"license":"MIT","_id":"@cypress-design/vue-textbox@1.0.1","gitHead":"d2cf10fb4bd2160503c26f4feabdf38b7b84457c","description":"## Install","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-6D6gjUElKM/bIxQ41W3+leFbzODPu+/AmZrYeSdInZNIs8p1NnTIjXoibQa3TcjPnC6nne4Zgv/2BLuzIQ3LXg==","shasum":"f08ade24ca177bb3fc93a76103748789b5b69831","tarball":"https://registry.npmjs.org/@cypress-design/vue-textbox/-/vue-textbox-1.0.1.tgz","fileCount":17,"unpackedSize":155406,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDaRx4v4EoyQScH8HvQZr1S44WpMPdXdycPT902eSjvPgIgV0HbbQMNiZoH2eQCdmowZ8VMJee8ak9YhEWA0Dfi7nk="}]},"_npmUser":{"name":"cypress-npm-publisher","email":"cypress-npm-publisher@cypress.io"},"directories":{},"maintainers":[{"name":"cypress-npm-publisher","email":"cypress-npm-publisher@cypress.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/vue-textbox_1.0.1_1770052301915_0.8617833263817112"},"_hasShrinkwrap":false}},"time":{"created":"2026-02-02T17:11:41.723Z","1.0.1":"2026-02-02T17:11:42.058Z","modified":"2026-02-02T17:11:42.329Z"},"maintainers":[{"name":"cypress-npm-publisher","email":"cypress-npm-publisher@cypress.io"}],"description":"## Install","license":"MIT","readme":"# Textbox\n\n## Install\n\nThe textbox component is contained in the `@cypress-design/vue-textbox` package. You'll also want to install `@cypress-design/constants-textbox` to get proper types for TypeScript.\n\n```bash\nnpm install @cypress-design/vue-textbox @cypress-design/constants-textbox\n```\n\nor with yarn\n\n```bash\nyarn add @cypress-design/vue-textbox @cypress-design/constants-textbox\n```\n\n## Usage\n\n```ts\nimport Textbox from '@cypress-design/vue-textbox'\n```\n\n```vue\n<script lang=\"ts\" setup>\nimport { IconShapeLightningBolt } from '@cypress-design/vue-icon'\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <Textbox :icon-left=\"IconShapeLightningBolt\" placeholder=\"Search...\" />\n</template>\n```\n\n## Possible variants\n\nThe Textbox component supports four variants: `default`, `valid`, `invalid`, and `warning`. Each variant has different visual styling to indicate the input state.\n\n### Placeholders\n\nAll variants with placeholder text:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-white p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox variant=\"default\" placeholder=\"Default placeholder\" />\n      <Textbox variant=\"valid\" placeholder=\"Valid placeholder\" />\n      <Textbox variant=\"invalid\" placeholder=\"Invalid placeholder\" />\n      <Textbox variant=\"warning\" placeholder=\"Warning placeholder\" />\n    </div>\n  </div>\n</template>\n```\n\n### Types\n\nAll variants with values:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-white p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox variant=\"default\" value=\"Default\" />\n      <Textbox variant=\"valid\" value=\"Valid\" />\n      <Textbox variant=\"invalid\" value=\"Invalid\" />\n      <Textbox variant=\"warning\" value=\"Warning\" />\n      <Textbox disabled value=\"Disabled\" />\n    </div>\n  </div>\n</template>\n```\n\n### Dark mode\n\nAll variants in dark mode with placeholders:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-gray-1000 p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox theme=\"dark\" variant=\"default\" placeholder=\"Default\" />\n      <Textbox theme=\"dark\" variant=\"valid\" placeholder=\"Valid\" />\n      <Textbox theme=\"dark\" variant=\"invalid\" placeholder=\"Invalid\" />\n      <Textbox theme=\"dark\" variant=\"warning\" placeholder=\"Warning\" />\n    </div>\n  </div>\n</template>\n```\n\nAll variants in dark mode with values:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-gray-1000 p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox theme=\"dark\" variant=\"default\" value=\"Default\" />\n      <Textbox theme=\"dark\" variant=\"valid\" value=\"Valid\" />\n      <Textbox theme=\"dark\" variant=\"invalid\" value=\"Invalid\" />\n      <Textbox theme=\"dark\" variant=\"warning\" value=\"Warning\" />\n      <Textbox theme=\"dark\" disabled value=\"Disabled\" />\n    </div>\n  </div>\n</template>\n```\n\n## Sizes\n\nThe Textbox supports three sizes: `32`, `40` (default), and `48`.\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-white p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox size=\"32\" value=\"Size 32\" />\n      <Textbox size=\"40\" value=\"Size 40\" />\n      <Textbox size=\"48\" value=\"Size 48\" />\n    </div>\n  </div>\n</template>\n```\n\nDark mode:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-gray-1000 p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox theme=\"dark\" size=\"32\" value=\"Size 32\" />\n      <Textbox theme=\"dark\" size=\"40\" value=\"Size 40\" />\n      <Textbox theme=\"dark\" size=\"48\" value=\"Size 48\" />\n    </div>\n  </div>\n</template>\n```\n\n## Rounded\n\nThe Textbox supports a `rounded` prop to toggle between rounded and square corners. Shown here with size 40px:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-white p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox size=\"40\" :rounded=\"false\" value=\"Not rounded\" />\n      <Textbox size=\"40\" :rounded=\"true\" value=\"Rounded\" />\n    </div>\n  </div>\n</template>\n```\n\nDark mode:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\n</script>\n\n<template>\n  <div class=\"bg-gray-1000 p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox theme=\"dark\" size=\"40\" :rounded=\"false\" value=\"Not rounded\" />\n      <Textbox theme=\"dark\" size=\"40\" :rounded=\"true\" value=\"Rounded\" />\n    </div>\n  </div>\n</template>\n```\n\n## Options\n\nThe Textbox supports various combinations of optional elements. All sizes with labels on the left and right:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\nimport { IconShapeLightningBolt } from '@cypress-design/vue-icon'\n</script>\n\n<template>\n  <div class=\"bg-white p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox\n        :divider=\"true\"\n        size=\"32\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 32\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        size=\"40\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 40\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        variant=\"valid\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        variant=\"invalid\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        variant=\"warning\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        disabled\n        :divider=\"true\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"disabled\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :rounded=\"true\"\n        :divider=\"true\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n    </div>\n  </div>\n</template>\n```\n\nDark mode:\n\n```vue live\n<script lang=\"ts\" setup>\nimport Textbox from '@cypress-design/vue-textbox'\nimport { IconShapeLightningBolt } from '@cypress-design/vue-icon'\n</script>\n\n<template>\n  <div class=\"bg-gray-1000 p-4 rounded\">\n    <div class=\"flex flex-col gap-4\">\n      <Textbox\n        :divider=\"true\"\n        theme=\"dark\"\n        size=\"32\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 32\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        theme=\"dark\"\n        size=\"40\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 40\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        theme=\"dark\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        theme=\"dark\"\n        variant=\"valid\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        theme=\"dark\"\n        variant=\"invalid\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :divider=\"true\"\n        theme=\"dark\"\n        variant=\"warning\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        disabled\n        :divider=\"true\"\n        theme=\"dark\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"disabled\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n      <Textbox\n        :rounded=\"true\"\n        theme=\"dark\"\n        :divider=\"true\"\n        size=\"48\"\n        label-left=\"Label left\"\n        label-right=\"Label right\"\n        value=\"Size 48\"\n        :icon-left=\"IconShapeLightningBolt\"\n        :icon-right=\"IconShapeLightningBolt\"\n      />\n    </div>\n  </div>\n</template>\n```\n\n## Template Refs\n\nThe Textbox component supports template refs, allowing you to access the underlying input element directly:\n\n```vue\n<template>\n  <div>\n    <Textbox ref=\"inputRef\" placeholder=\"Type here...\" />\n    <button @click=\"handleFocus\">Focus Input</button>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport Textbox from '@cypress-design/vue-textbox'\n\nconst inputRef = ref<InstanceType<typeof Textbox> | null>(null)\n\nconst handleFocus = () => {\n  // Access the input element through the component instance\n  const input = inputRef.value?.$el?.querySelector('input')\n  input?.focus()\n}\n</script>\n```\n\nThis is useful for:\n\n- Programmatically focusing the input\n- Accessing input methods like `select()`, `setSelectionRange()`\n- Integrating with third-party libraries that need direct DOM access\n\n## Keyboard Event Handlers\n\nThe Textbox component supports keyboard event handlers for advanced interactions:\n\n```vue\n<template>\n  <Textbox\n    placeholder=\"Press Enter...\"\n    @keydown=\"handleKeyDown\"\n    @keyup=\"handleKeyUp\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport Textbox from '@cypress-design/vue-textbox'\n\nconst handleKeyDown = (e: KeyboardEvent) => {\n  if (e.key === 'Enter') {\n    console.log('Enter pressed')\n  }\n}\n\nconst handleKeyUp = (e: KeyboardEvent) => {\n  console.log('Key released:', e.key)\n}\n</script>\n```\n\n### Available Keyboard Events\n\n- **@keydown**: Fired when a key is pressed down\n- **@keyup**: Fired when a key is released\n\n## Common Input Attributes\n\nThe Textbox component supports all standard HTML input attributes. This includes:\n\n### Form Attributes\n\n- **readonly**: Makes the input read-only\n- **required**: Marks the input as required for form validation\n- **name**: Input name for form submission\n- **form**: Associates input with a form element\n\n### Validation Attributes\n\n- **maxlength**: Maximum number of characters\n- **minlength**: Minimum number of characters\n- **pattern**: Regular expression pattern for validation\n- **title**: Tooltip text shown on validation error\n\n### Other Attributes\n\n- **readonly**: Alias for readonly\n- **tabindex**: Tab order\n- **autocomplete**: Autocomplete behavior\n- **spellcheck**: Enable/disable spell checking\n\nExample:\n\n```vue\n<Textbox\n  placeholder=\"Username\"\n  name=\"username\"\n  required\n  maxlength=\"20\"\n  minlength=\"3\"\n  pattern=\"[a-zA-Z0-9]+\"\n  title=\"Username must be 3-20 alphanumeric characters\"\n/>\n```\n\n## Real-World Use Cases\n\n### Form Input with Validation\n\n```vue\n<template>\n  <div>\n    <Textbox\n      type=\"email\"\n      placeholder=\"Email\"\n      v-model=\"email\"\n      @blur=\"validateEmail\"\n      :variant=\"error ? 'invalid' : 'default'\"\n      :aria-describedby=\"error ? 'email-error' : undefined\"\n    />\n    <div v-if=\"error\" id=\"email-error\">{{ error }}</div>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref } from 'vue'\nimport Textbox from '@cypress-design/vue-textbox'\n\nconst email = ref('')\nconst error = ref('')\n\nconst validateEmail = () => {\n  if (!email.value.includes('@')) {\n    error.value = 'Invalid email address'\n  } else {\n    error.value = ''\n  }\n}\n</script>\n```\n\n### Search Input with Keyboard Shortcuts\n\n```vue\n<template>\n  <Textbox\n    ref=\"inputRef\"\n    :icon-left=\"IconShapeLightningBolt\"\n    placeholder=\"Search (press / to focus)\"\n    @keydown=\"handleKeyDown\"\n  />\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, onMounted, onUnmounted } from 'vue'\nimport Textbox from '@cypress-design/vue-textbox'\nimport { IconShapeLightningBolt } from '@cypress-design/vue-icon'\n\nconst inputRef = ref<InstanceType<typeof Textbox> | null>(null)\n\nconst handleKeyDown = (e: KeyboardEvent) => {\n  if (e.key === 'Escape') {\n    const input = inputRef.value?.$el?.querySelector('input')\n    input?.blur()\n  }\n}\n\nonMounted(() => {\n  const handleKeyPress = (e: KeyboardEvent) => {\n    if (\n      e.key === '/' &&\n      e.target !== inputRef.value?.$el?.querySelector('input')\n    ) {\n      e.preventDefault()\n      const input = inputRef.value?.$el?.querySelector('input')\n      input?.focus()\n    }\n  }\n\n  window.addEventListener('keydown', handleKeyPress)\n  onUnmounted(() => {\n    window.removeEventListener('keydown', handleKeyPress)\n  })\n})\n</script>\n```\n\n### Controlled Input with Debouncing\n\n```vue\n<template>\n  <div>\n    <Textbox v-model=\"value\" placeholder=\"Search...\" />\n    <p>Searching for: {{ debouncedValue }}</p>\n  </div>\n</template>\n\n<script setup lang=\"ts\">\nimport { ref, watch } from 'vue'\nimport Textbox from '@cypress-design/vue-textbox'\n\nconst value = ref('')\nconst debouncedValue = ref('')\n\nlet timeoutId: ReturnType<typeof setTimeout>\n\nwatch(value, (newValue) => {\n  clearTimeout(timeoutId)\n  timeoutId = setTimeout(() => {\n    debouncedValue.value = newValue\n  }, 300)\n})\n</script>\n```\n\n## Props\n\n(Props section will be auto-generated by vue-docgen-cli)\n","readmeFilename":"ReadMe.md","_rev":"1-935dc31db349d9c1815928c8a90d7a27"}