vwf .

API Reference

Complete API documentation for components, utilities, and framework core

Input

Form input component with validation and messages

🔧 Props

PropertyTypeDefaultDescription
idstringinput-{timestamp}Unique identifier
labelstringundefinedField label
typestringtextInput type
valuevan.state<string>''Controlled value state
messageobject{}Message object with code and detail
placeholderstring''Placeholder text
requiredbooleanfalseRequired field indicator
oninputfunctionundefinedInput change handler
onblurfunctionundefinedBlur event handler

💻 Examples

Basic Input

const email = van.state('');
return Input({
  label: 'Email',
  type: 'email',
  value: email,
  placeholder: 'you@example.com',
  oninput: (e) => email.val = e.target.value
});

▶️ Live Preview

💡 Click "Edit Code" to modify the example

🔄 Click "Apply Changes" to see your modifications

↩️ Click "Reset" to restore original code

With Validation

const email = van.state('');
const message = van.state({});

return Input({
  label: 'Email',
  type: 'email',
  value: email,
  message,
  oninput: (e) => {
    email.val = e.target.value;
    if (!e.target.value.includes('@')) {
      message.val = { code: 'error', detail: 'Invalid email' };
    } else {
      message.val = { code: 'success', detail: 'Valid!' };
    }
  }
});

▶️ Live Preview

💡 Click "Edit Code" to modify the example

🔄 Click "Apply Changes" to see your modifications

↩️ Click "Reset" to restore original code

💡 Usage Tips

• Always provide value state for controlled components

• Use message object with code (type) and detail (text)

• Handle validation in oninput for real-time or onblur for deferred

• Input auto-generates ID if not provided to prevent console errors

🔗 Related

Explore vwf

Discover what vwf can do