@rhc-shared-components/form-select-component
v0.2.7
Published
project description
Downloads
117
Keywords
Readme
@rhc-shared-components/sample-project
project description
Install
npm install --save @rhc-shared-components/form-select-component
Usage
import React from 'react';
import {
FormSelect,
ISelectItem
} from '@rhc-shared-components/form-select-component';
import { Form, Formik } from 'formik';
const App = () => {
const FieldName = 'form multi select';
const options = [
'Accounting',
'API Management',
'Application Delivery',
'Application Server',
'Automation',
'Backup & Recovery',
'Business Intelligence',
'Business Process Management',
'Capacity Management'
];
const getActions = () => {
const getAllOptions: ISelectItem[] = options.map((item) => ({
value: item
}));
return getAllOptions;
};
return (
<Formik
initialValues={{
[FieldName]: 'test'
}}
enableReinitialize={true}
onSubmit={() => {}}
>
<Form>
<FormSelect
name={FieldName}
label='Types of business'
placeholder='Select'
selectOptions={getActions()}
isRequired
/>
</Form>
</Formik>
);
};
export default App;
License
MIT © authorGithubUsername