Skip to content

ControlElement ​

This is basically a wrapper that removes border, shadow, margin from the inside element and gives it a label.

It gives an inner element a freedom to be whatever it wants.

Live Demo ​

Sizes ​

The size prop controls font-size, padding, border-radius, and element sizing across all wrapped components. Available sizes: sm, md (default), lg, xl.

Input ​

Input with Icons ​

Textarea ​

Button ​

Button with Icons ​

SwitchButton ​

Selector ​

CheckBox ​

Inner Layout ​

Input and Textarea support layout="inner", which floats the label inside the control boundary. The label starts as a placeholder and animates upward when the field is focused or filled.

Input ​

Textarea ​

Inner with sizes ​

Usage ​

vue
<template>
  <orio-control-element label="You can add label here">
    <input
      type="text"
      placeholder="Notice standard styling is not a case here"
      style="width: stretch"
    />
  </orio-control-element>
</template>

Setting Size ​

vue
<!-- Size applies to any component wrapped with ControlElement -->
<orio-input v-model="name" label="Name" size="sm" />
<orio-input v-model="name" label="Name" size="md" />
<orio-input v-model="name" label="Name" size="lg" />
<orio-input v-model="name" label="Name" size="xl" />

<orio-button size="lg">Large Button</orio-button>
<orio-selector v-model="value" :options="options" size="sm" />

Props ​

PropTypeDefaultDescription
appearance'normal' | 'minimal''normal'Minimal removes margin, border, and box-shadow from slot
size'sm' | 'md' | 'lg' | 'xl''md'Controls font-size, padding, and radius of inner elements
layout'vertical' | 'horizontal''vertical'Label position relative to the control
labelstring-Label text displayed above the control

Slots ​

SlotDescription
defaultForm control element

The default slot exposes a control prop — the attribute bag your inner element must spread. Every key is already written as the DOM attribute it becomes, so v-bind is all that is needed:

vue
<orio-control-element v-slot="{ control }" label="Email" :error="emailError">
  <input v-bind="control" type="email" />
</orio-control-element>

Accessibility ​

Bag keySource
idid prop, or useId() — the <label for> target
tabindextabindex prop
disableddisabled prop
requiredrequired prop
namename prop
focus-keyfocusKey prop — the attr useRovingGrid queries
aria-labelariaLabel prop — for controls with no visible label
aria-describedbyid of the .control-error span, when error is set
aria-invalid"true" when error is set
aria-requiredrequired prop

Keys are omitted when there is nothing to say, so no empty aria-label="" reaches the markup.

CSS Variables ​

ControlElement sets the following CSS custom properties based on size, which child components consume:

Variablesmmd (default)lgxl
--control-font-size0.75rem0.875rem1.25rem1.75rem
--control-label-font-size0.65rem0.75rem0.875rem1.25rem
--control-py0.25rem0.5rem0.625rem0.75rem
--control-px0.5rem0.75rem1rem1.25rem
--control-gap0.25rem0.5rem0.5rem0.75rem
--control-radius4px8px8px12px
--control-icon-size0.75rem1rem1.25rem1.5rem

Notes ​

  • Used internally by Input, Textarea, DatePicker, etc.
  • Provides consistent spacing and layout
  • Can be used to wrap custom form controls
  • The label is passed via attributes and rendered automatically
  • Size cascades via CSS variables — child components read them automatically