@react-ui-types/shared
Version:
Ladifire UI components in React
43 lines (38 loc) • 1.48 kB
TypeScript
/*
* Copyright 2020 Ladifire. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*/
import {ReactNode} from 'react';
export type LabelPosition = 'top' | 'side';
export type Alignment = 'start' | 'end';
export type NecessityIndicator = 'icon' | 'label';
export interface LabelableProps {
/** The content to display as the label. */
label?: ReactNode,
/** Whether the label is labeling a required field or group. */
isRequired?: boolean
}
export interface SpectrumLabelableProps extends LabelableProps {
/**
* The label's overall position relative to the element it is labeling.
* @default 'top'
*/
labelPosition?: LabelPosition,
/**
* The label's horizontal alignment relative to the element it is labeling.
* @default 'start'
*/
labelAlign?: Alignment,
/**
* Whether the required state should be shown as an icon or text.
* @default 'icon'
*/
necessityIndicator?: NecessityIndicator
}