Skip to content

TradeInput

Currency amount input with integrated currency picker for trade flows.

Open in Storybook

Interactive Demo

States

Different states

Usage

vue
<script setup>
import { ref } from 'vue';
import { TradeInput } from '@yellowcard/b2b-design-system';

const amount = ref('');
const currency = ref('NGN');
const currencies = [
  { label: 'Nigerian Naira', value: 'NGN' },
  { label: 'US Dollar', value: 'USD' },
];
</script>

<template>
  <TradeInput
    v-model="amount"
    label="You send"
    :selectedCurrency="currency"
    :currencies="currencies"
  />
</template>

API Reference

Props

PropTypeDefaultDescription
modelValuestring''Amount value (v-model)
labelstring'You convert'Input label
placeholderstring'0.00'Placeholder text
selectedCurrencystring''Selected currency code
currenciesCurrencyOption[][]Available currencies
statestring'default'Input state (default, hover, active, focus, filled, error, disabled)
disabledbooleanfalseDisabled state
inputDisabledbooleanfalseDisable only the input
currencyDisabledbooleanfalseDisable currency picker
errorMessagestring''Error message text
maxDecimalsnumber2Maximum decimal places
formatAsCurrencybooleantrueFormat with currency notation
showThousandsSeparatorbooleantrueShow thousands separators
showChevronbooleantrueShow currency dropdown chevron

Events

EventPayloadDescription
update:modelValuestringAmount value changed
currency-changestringCurrency selection changed