Function ControlButtonsAltComponent

ControlButtonsAltComponent is a React functional component that renders a set of control buttons with customizable alignment, direction, and styling options.

This component accepts an array of button configurations, allowing each button to have custom icons, colors, and functionality, displayed in either horizontal or vertical layout.

import React from 'react';
import { ControlButtonsAltComponent } from 'mediasfu-reactjs';
import { faPlay, faPause, faStop } from '@fortawesome/free-solid-svg-icons';

function App() {
const buttons = [
{
name: 'Play',
icon: faPlay,
onPress: () => console.log('Play button pressed'),
backgroundColor: { default: 'green' },
active: true,
},
{
name: 'Pause',
icon: faPause,
onPress: () => console.log('Pause button pressed'),
backgroundColor: { default: 'red' },
},
{
name: 'Stop',
icon: faStop,
onPress: () => console.log('Stop button pressed'),
backgroundColor: { default: 'blue' },
},
];

return (
<ControlButtonsAltComponent
buttons={buttons}
position="left"
location="top"
direction="horizontal"
buttonsContainerStyle={{ padding: 10 }}
showAspect={true}
/>
);
}

export default App;

Properties

propTypes?: WeakValidationMap<ControlButtonsAltComponentOptions>

Used to declare the types of the props accepted by the component. These types will be checked during rendering and in development only.

We recommend using TypeScript instead of checking prop types at runtime.

contextTypes?: ValidationMap<any>

Lets you specify which legacy context is consumed by this component.

defaultProps?: Partial<ControlButtonsAltComponentOptions>

Used to define default values for the props accepted by the component.

type Props = { name?: string }

const MyComponent: FC<Props> = (props) => {
return <div>{props.name}</div>
}

MyComponent.defaultProps = {
name: 'John Doe'
}
displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.


const MyComponent: FC = () => {
return <div>Hello!</div>
}

MyComponent.displayName = 'MyAwesomeComponent'