Empty state
Explain an empty collection or unavailable result and provide its next useful action.
Default
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let defaultEmptyState =
fveEmptyState {
_label "No items yet"
_description "Add your first item to get started."
}On this page
Installation
Copy this component and its required dependencies into the consumer-owned Components project.
dotnet fve add empty-state --config src/Acme.Components/fve.jsonNo additional JavaScript import is required.
The CLI resolves dependencies and preserves consumer-authored files. See Installation for project initialization, Tailwind, the shared runtime, and building/loading your app entry.
Usage
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let defaultEmptyState =
fveEmptyState {
_label "No items yet"
_description "Add your first item to get started."
}Title only
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let titleOnlyEmptyState =
fveEmptyState { _label "No matching items" }Description is optional. Add guidance or recovery actions only when they help the user.
With recovery action
open System
open FSharp.ViewEngine
open Acme.Components
open type Html
open type Svg
open type Datastar
let plusIcon = fveIcon { _name IconName.Plus; _variant IconVariant.Micro }
let emptyStateExample =
fveEmptyState {
_label "No matching items"
_description "Clear your filters to see all items."
fveEmptyStateIcon { plusIcon }
fveEmptyStateActions {
fveLink {
_variant LinkVariant.Outline
_color Color.Neutral
_href "/components/empty-state"
"Clear filters"
}
}
}This example also uses Icon. See their Installation sections for any additional setup.
API reference
module EmptyStateDsl =
val fveEmptyState : ComponentElementBuilder
val fveEmptyStateIcon : ComponentElementBuilder
val fveEmptyStateActions : ComponentElementBuilder