React Form - SimpleItem.label
Specifies properties for the form item label.
alignment
Specifies the label's horizontal alignment. Applies only to labels outside their editors (see labelMode).
component
An alias for the template property specified in React. Accepts a custom component. Refer to Using a Custom Component for more information.
location
Specifies the location of a label against the editor. Applies only to labels outside their editors (see labelMode).
See Also
render
An alias for the template property specified in React. Accepts a rendering function. Refer to Using a Rendering Function for more information.
showColon
Specifies whether a colon is displayed at the end of the current label. Applies only to labels outside their editors (see labelMode).
template
A template that can be used to replace the label with custom content. Applies only to labels outside their editors (see labelMode).
The following code adds a custom label to the SimpleItem:
jQuery
$(function() {
$("#formContainer").dxForm({
// ...
items: [{
label: {
template(data) {
return `Custom ${data.text}`;
}
}
}]
});
});Angular
<dx-form ... >
<dxi-item ... >
<dxo-label template="customLabel"></dxo-label>
</dxi-item>
<div *dxTemplate="let data of 'customLabel'">
<span>Custom {{ data.text }}</span>
</div>
</dx-form>Vue
<template>
<DxForm ...>
<DxSimpleItem ...>
<DxLabel template="customLabel"/>
</DxSimpleItem>
<template #customLabel="{ data }">
<span>
Custom {{ data.text }}
</span>
</template>
</DxForm>
</template>
<script>
// ...
</script>React
const customItem = (data) => {
return `Custom ${data.text}`;
}
function App() {
return (
<Form ...>
<SimpleItem ...>
<Label render={customItem} />
</SimpleItem>
</Form>
);
};
export default App;visible
Controls the visibility of the label outside the editor.
This property defaults to true in the following cases:
- The labelMode is "outside".
- The editor does not support embedded labels and therefore does not support "static" and "floating" label modes. Refer to the labelMode article for a list of these editors.
In other cases, the property defaults to false.
If you have technical questions, please create a support ticket in the DevExpress Support Center.