Skip to content

FocusWithinDirective

directive

Directive keeping track of the focus beeing within a component. Once the component or any of its child components gain focus, a class of focusWithin will be set on the host component in order to allow styling it while beeing focused. Furthermore you can register callbacks once the component gets or looses focus.

Example :

// just set the css class
<some-component yuvFocusWithin></some-component>
// set the css class and listen to focus changes
<some-component (yuvFocusWithin)="onFocusEnter()" (yuvFocusWithinBlur)="onFocusLeave()"></some-component>

Selector: [yuvFocusWithin]

Standalone: Yes

Type: EventEmitter

Emitted once the component or any of its child components gains focus.

Type: EventEmitter

Emitted once the component (incl. any of its child components) looses focus.

Type: unknown

Default Value: false

onFocusIn(evt: FocusEvent): void
NameTypeDescription
evtFocusEvent
onFocusOut(evt: FocusEvent): void
NameTypeDescription
evtFocusEvent