### File

`packages/components/eui-card/services/ui-state.service.ts`

### Description

Service for managing UI state of card components including collapse, urgency, and expander positioning. Provides reactive state management through RxJS observables for card component behavior. Injected at component level to maintain isolated state per card instance. Manages collapsible state, collapsed state, urgent styling, and left expander positioning.

### Index

###### Methods

- setState
- Public toggleCollapsed

###### Accessors

- state$
- state
- isCollapsed
- isCollapsible

### Methods

setState
`setState(nextState: UIState)`

Updates the UI state with provided properties. Merges the next state with current state, preserving unchanged properties.

Parameters :

Name | Type | Optional
nextState | `UIState` | No

Returns : `void`

Public toggleCollapsed
`toggleCollapsed()`
Toggles the collapsed state of the card. Switches between collapsed and expanded states. Returns : `void`

### Accessors

state$
get `state$()`
Observable stream of UI state changes. Emits whenever any state property is updated via setState or setters. Returns : `Observable<UIState>`

state
get `state()`
Current UI state snapshot. Returns the current state value without subscribing to changes. Returns : `UIState`

isCollapsed
set `isCollapsed(isActive: boolean)`

Sets the collapsed state of the card. When true, card content is hidden; when false, content is visible.

Parameters :

Name | Type | Optional
isActive | `boolean` | No

Returns : `void`

isCollapsible
set `isCollapsible(isActive: boolean)`

Sets whether the card is collapsible. When true, enables collapse/expand functionality; when false, card remains static.

Parameters :

Name | Type | Optional
isActive | `boolean` | No

Returns : `void`

# results matching ""

# No results matching ""