Sorry, but you either have no stories or none are selected somehow.
If the problem persists, check the browser console, or the terminal you've run Storybook from.
Install Concrete in your project by running
Concrete components can be imported individually in your project
However, the best way to use the components and take advantage of Concrete's other features is to install the Concrete Vue plugin:
The Concrete Vue plugin accepts the following options
Option | Type | Default |
---|---|---|
size | string: 'xs' |'sm'|'md'|'lg'|'xl' | 'sm' |
components | array | null |
labelFormatter | function(label: string) | null |
inputHandler | function(id: string, value: any) | null |
inputIdToValue | function(id: string) | null |
registerInputs | function(id: string, el: HTMLElement) | boolean | null |
inputGetStatus | function(id: string) | null |
wrapFormInputs | boolean | true |
customUnits | array | null |
components
Specifies which components should be made globally available within the application. If the property is falsy then all components will be loaded. To prevent any components from being registered, pass an empty array.
size
Specifies the default size for all components with a size
prop.
labelFormatter
default null
Specifies a function for formatting labels in form input groups
inputHandler
Specifies a function for globally handling changes in input values.
The handler is called with the id
of the input and the updated value.
This feature allows you to standardise the behaviour of all inputs in your application
e.g. connecting them to store functionality
wrapFormInputs
Specifies whether inputs should be wrapped in a <FormElement>
component by default (default true
).
This option can be overridden by components using the no-wrap
prop.
customUnits
This option allows you to pass multiple unit conversions into concrete to be used in conjunction with <CNumericInput>
's unit
prop.
Best practice dictates that all numeric values should be stored as SI values. However, it is often more appropriate and familiar for users to use converted units in the UI.
Concrete provides many of the common conversions out of the box, but for when a unit does not exist you can pass in your own conversions as an option.
customUnits
should be an array of items each containing the following properties:
unit: string
- the unit you wish to add. This will also be the value you specify in the unit
prop of the numeric input.siUnit: string
- the SI unit related to the unit you are addingconversions: object
- an object containing the following properties to convert to and from SI respectively:toSI: function(convertedValue: Big)
- function for converting the converted value back to SIfromSI: function(siValue: Big)
- function for converting the SI value to the custom unitsPLEASE NOTE - the values passed into toSI/fromSI
are not number types, but a Big
instance, used to prevent rounding issues with Javascript floats.
Therefore, when converting values the times
and div
methods should be used.
See the following example for adding a nanometers conversion
The options, with the exception of components
, will be available throughout all the Vue components in your application
by injecting the concrete
property