useInputs
This hook returns the widget's user-configured inputs as a read-only record. It provides access to input values that have been set through the widget configuration in the Console.
Import
import { useInputs } from "~lib/use-inputs";
API
const inputs = useInputs();
Parameters
This hook takes no parameters.
Return Value
| Name | Type | Description |
|---|---|---|
| inputs | Readonly<Record<string, string>> | A read-only object mapping input names to their values |
Example
import { useInputs } from "~lib/use-inputs";
const Widget = () => {
const inputs = useInputs();
return (
<div>
<h2>Configuration</h2>
<ul>
{Object.entries(inputs).map(([key, value]) => (
<li key={key}>
<strong>{key}:</strong> {value}
</li>
))}
</ul>
</div>
);
};
See Also
- useAssets - Get the widget's uploaded assets
- useResolution - Get the widget resolution
- useTheme - Get the current theme setting