LabelTron
The LabelTron
component is a React functional component that translates text into multiple languages at specified intervals. It displays the translated text along with an optional icon.
Props
children
- Type:
string
- Description: The text content to be translated.
interval
- Type:
number
- Description: The interval in milliseconds at which the text should be translated.
languages
- Type:
string[]
- Description: An array of language codes into which the text should be translated.
icon
(optional)
- Type:
object
- Description: An optional object to display an icon alongside the text.
className
(optional):string
- Additional class names for the icon.visible
(optional):boolean
- Whether the icon should be visible.iconElement
(optional):React.ReactNode
- The icon element to be displayed.
...props
- Type:
React.HTMLAttributes<HTMLLabelElement>
- Description: Additional HTML attributes to be passed to the label element.
Example Usage
import React from 'react';
import {LabelTron} from '@revivesoft/inputron';
const Example = () => (
<LabelTron
interval={1000}
languages={['en', 'es', 'fr']}
icon={{ className: 'icon-class', visible: true, iconElement: <YourIconComponent /> }}
>
Hello, world!
</LabelTron>
);
export default Example;