Skip to content

Text Input


vue
<template>
  <PeachyInput.Input class="text">
    <PeachyTextInput.Input
      v-bind="$attrs"
      v-model:value="input"
      placeholder="Placeholder">
      <template #before>
        <PeachyInput.Label>Text input</PeachyInput.Label>
      </template>
    </PeachyTextInput.Input>
  </PeachyInput.Input>
</template>
css
.peachy-input.text {
  display: grid;
  gap: var(--gap);
  grid-template-rows: auto auto;
}

.peachy-text-input__input {
  font: inherit;
  color: inherit;

  border-radius: 0.15rem;
  padding: 0.5rem;
  width: 15rem;

  background-color: var(--bg);
  border: 1px solid var(--border);
  caret-color: var(--brand-color);

  transition: border-color 0.25s;
}

.peachy-text-input__input:not(:disabled):hover {
  border-color: var(--brand-color-dimmed);
}

.peachy-text-input__input:focus,
.peachy-text-input__input:focus-visible {
  outline: none !important;
  border-color: var(--brand-color);
}

Anatomy

vue
<template>
  <PeachyInput.Input>
    <PeachyInput.Label />
    <PeachyTextInput.Input />
  </PeachyInput.Input>
</template>

<script lang="ts" setup>
  import { PeachyInput, PeachyTextInput } from "typeach";
</script>

Props & Emits

Input


Props

NameDefaultTypeDescription
value""string?
disabledfalseboolean?
readonlyfalseboolean?
requiredfalseboolean?The component only labels it as required with aria-required and does not deal with any error messages for you.
textareafalseboolean?

Emits

@Payload
update:valuestring
validatestring
clear-validation

Styling

CSS Selectors

Follows our CSS classes convention.


State selectors

SelectorDescriptionFor
:disabledFor a disabled input.
  • Input
:read-onlyFor a read-only input.
  • Input
[data-textarea="<boolean>"] or textareaTo differentiate between an input and a textarea.
  • Input