useModel Hook
Diego Muralles avatar
Written by Diego Muralles
Updated over a week ago

Watches and returns the content model using the widget key. Content model refers to the intrinsic properties of the widget like element ID, classname, icon’s, and form-field values.


const widgetModel: IContent = useModel(key? string);
// empty key parameter returns the model of the widget you are currently coding.

IContent type interface

interface IContent {
//widget's element ID
key: string;
//widget's classname
type?: string;
style?: {}; //doesn't even work
//contents of the widget's formfield
content?: {};
//widget's classname
cl?: string;
pin?: boolean; //doesn't even work
html?: boolean; //DONT DOCUMENT
//icons set on the widget
icons?: { [key: string]: IShape };
actions?: string[];
children?: string[];


Observe another widget’s form-field value.

import { useModel } from 'vev';

export default function({ trackedWidget }: Props) {
const usemodel = useModel(trackedWidget.key);
return <h1>{usemodel.content.text}</h1>

Did this answer your question?