Skip to content

VegaInput ​

Customizable Input Component. This component provides a versatile input field with slots for labels and optional prefix or postfix content. It supports various styling options through props like font size, color, placeholder attributes, and more. By default, it uses a text input type, but you can specify other types as needed. The component also includes a debounce mechanism on input to limit the frequency of events, with a default delay of 300 milliseconds.

Simple example:

vue
<vega-input
  placeholder="Placeholder"
  label="label"
  background-color="var(--vp-custom-block-info-bg)"
  placeholder-color="gray"
  :delay-debounce="800"
  width="420px"
/>

<script setup>
  import { VegaInput } from 'vega-ui'
</script>

Code above will give you a following result:

label

Props ​

Here are the props available for the component. Each prop allows you to customize the input field in various ways, enhancing its functionality and style.

Prop nameTypeDefaultDescription
background-colorstring"none"Background color of the input.
border-colorstring"var(--vega-border-color)"Color of the input border.
border-radiusstring"4px"Border radius of the input field.
clearablebooleantrueIf set to true, adds a clear button to the input field, allowing quick clearing of its content.
delay-debouncenumber300Milliseconds to delay the input event for debouncing.
font-colorstring"var(--vega-text-color)"Text color of the input.
font-sizestring"inherit"Font size of the input text.
focus-border-colorstring"var(--vega-border-color)"Border color of the input when focused.
heightstring"auto"Height of the input field.
hover-border-colorstring"var(--vega-border-color)"Border color of the input on hover.
labelstring""Label above the input.
maxnumber``Max value for numeric type input.
minnumber``Min value for numeric type input.
model-valuestring | number | null""Value bound to the input and updated via v-model.
paddingstring"10px"Padding inside the input field.
placeholderstring""Text to display when the input is empty.
placeholder-colorstring"var(--vega-gray)"Color of the placeholder text.
readonlybooleanfalseIf set to true, the input field will be read-only, preventing user modifications.
text-alignstring"left"Text alignment within the input field.
typestring"text"Specifies the type of input (text, date, email, number, url).
widthstring"100%"Width of the input field.

Events ​

The component emits the following events:

Event NameDescription
focusEmitted when the input field gains focus.
blurEmitted when the input field loses focus.
update:modelValueEmitted with the current value of the input when it changes.
clearEmitted when the input field is cleared using the clear button.

Slots ​

The component provides slots that allow for the insertion of custom content at various points within the component.

Slot NameDescription
labelSlot for inserting a custom label above the input.
prefixSlot for adding content before the input field.
postfixSlot for adding content after the input field.
clearSlot for inserting custom content for the clear button.