Getting Started

Usage

Learn how to use EletroDS Vue 3 components in your application.

Learn how to use EletroDS Vue 3 components in your application.

Basic Usage

After installation, you can start using the components in your Vue templates:

App.vue
<template>
  <div>
    <MeInput color="primary" placeholder="Type here..." />
  </div>
</template>

<script setup>
import { MeInput } from '@mercadoeletronico/eds-next'
</script>

Component Registration

Global Registration

Register components globally for use throughout your application:

main.ts
import { createApp } from 'vue'
import { MeInput } from '@mercadoeletronico/eds-next'

const app = createApp(App)

app.component('MeInput', MeInput)

Local Registration

Register components locally in specific components:

MyComponent.vue
<script setup>
import { MeInput } from '@mercadoeletronico/eds-next'
</script>

<template>
  <MeInput color="primary" placeholder="Local Input" />
</template>

TypeScript Support

The library provides full TypeScript support with proper type definitions:

TypedInput.vue
<script setup lang="ts">
import { MeInput, type InputProps } from '@mercadoeletronico/eds-next'

const inputProps: InputProps = {
  color: 'primary',
  size: 'md',
  disabled: false
}
</script>

<template>
  <MeInput v-bind="inputProps" placeholder="Typed Input" />
</template>

Event Handling

Handle component events using Vue's event system:

EventHandling.vue
<template>
  <MeInput @change="handleChange" placeholder="Type here..." />
</template>

<script setup lang="ts">
const handleChange = (event: Event) => {
  console.log('Input changed!', event)
}
</script>

Styling and Customization

Components use Tailwind CSS classes and can be customized using the class prop:

CustomInput.vue
<template>
  <MeInput class="font-bold rounded-full" placeholder="Custom Input" />
</template>

You can also use the ui prop to override specific slots:

UiPropInput.vue
<template>
  <MeInput :ui="{ base: 'shadow-lg' }" placeholder="Styled Input" />
</template>

Best Practices

  1. Use TypeScript: Take advantage of the built-in type definitions
  2. Component Names: Use consistent naming conventions (e.g., MeInput)
  3. Props Validation: Leverage TypeScript for prop validation
  4. Event Handling: Use proper event typing for better development experience

Color System

EletroDS uses a semantic color system:

ColorUsage
primaryPrimary brand actions
secondarySecondary actions
successSuccess states and confirmations
warningWarning states
errorError states and destructive actions
infoInformational elements
neutralNeutral elements

Size System

Components support consistent sizing:

SizeDescription
xsExtra small
smSmall
mdMedium (default)
lgLarge
xlExtra large

Next Steps

Components

Explore all available components and their documentation.

Button

Learn about the Button component in detail.