# ghostkit/3.4.1/gutenberg/blocks/form/field-label/index.js

Block Animations, Motion &amp; Scroll Effects – Ghost Kit, version 3.4.1. 36 lines.

- Page: https://pluginprobe.com/plugins/ghostkit/3.4.1/code/gutenberg/blocks/form/field-label/index.js
- Raw: https://pluginprobe.com/plugins/ghostkit/3.4.1/raw/gutenberg/blocks/form/field-label/index.js
- Modified: 2024-02-18T18:40:24+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/ghostkit/3.4.1/code/gutenberg/blocks/form/field-label/index.js#L10-L20`.

```javascript
import { RichText } from '@wordpress/block-editor';
import { __ } from '@wordpress/i18n';

/**
 * Field Label Class.
 *
 * @param props
 */
export default function FieldLabel(props) {
	const { attributes, setAttributes, isSelected } = props;

	const { label, hideLabel } = attributes;

	if (!label && !isSelected) {
		return null;
	}

	if (hideLabel && !isSelected) {
		return null;
	}

	return (
		// eslint-disable-next-line jsx-a11y/label-has-associated-control
		<label className="ghostkit-form-field-label">
			<RichText
				inlineToolbar
				tagName="span"
				value={label}
				placeholder={__('Write label…', 'ghostkit')}
				onChange={(val) => setAttributes({ label: val })}
			/>
			{attributes.required ? <span className="required">*</span> : ''}
		</label>
	);
}

```
