UNPKG

weavify

Version:

````markdown # **Weavify - Reusable UI Components**

56 lines (55 loc) 2.6 kB
/** * CustomSelect Component * * A flexible and customizable select input component designed to work with Material UI. * It supports features like customizable labels, placeholders, size options, and more. * * Author: Anish Kumar * Email: anishbishnoi127@gmail.com * * @param {string} value - The current selected value in the dropdown. This is controlled by the parent component. * @param {function} onChange - A callback function that gets called when the selected option changes. * It provides the updated value and the selected item. * @param {Array} options - An array of options to display in the dropdown. Each option should have a 'value' and 'label'. * @param {string} [label] - An optional label to display above the select input. If not provided, no label is shown. * @param {string} [placeholder='Select an option'] - A placeholder that appears when no option is selected. * @param {'small' | 'medium'} [size='small'] - The size of the select input. Can either be 'small' or 'medium'. * @param {string} [selectStyle] - A custom class name for additional styling of the select input. * @param {React.InputHTMLAttributes<HTMLInputElement>} [inputProps] - Any extra properties you want to pass to the underlying input element. * @param {boolean} [isLabelRequired=false] - Whether the label should be marked as required. This only affects the label display. * @param {string} [wrapperStyle] - A custom class name for the wrapper around the select component. * @param {string} [id] - An optional id for the select input element. * @param {boolean} [required=false] - If true, the select input is marked as required for form validation. */ import { SelectChangeEvent } from '@mui/material'; import React from 'react'; interface Option { value: string | number; label: string; } interface CustomSelectProps { value: string; onChange: (event: SelectChangeEvent, child: React.ReactNode) => void; options: Option[]; label?: string; placeholder?: string; size?: 'small' | 'medium'; selectStyle?: string; inputProps?: React.InputHTMLAttributes<HTMLInputElement>; isLabelRequired?: boolean; wrapperStyle?: string; id?: string; required?: boolean; } export declare const selectWithRequiredProps: { isLabelRequired: boolean; required: boolean; }; export declare const selectWithPlaceholderProps: { placeholder: string; }; export declare const selectStyleProps: { selectStyle: string; }; declare const _default: React.NamedExoticComponent<CustomSelectProps>; export default _default;