Table of Contents

Class HtmxComponentOptions

Namespace
Htmx.Components
Assembly
Htmx.Components.dll

Configuration options for the HTMX Components library. This class provides a fluent API for configuring various aspects of the component system including navigation providers, authorization, view paths, and model handlers.

public class HtmxComponentOptions
Inheritance
HtmxComponentOptions
Inherited Members
Extension Methods

Methods

WithAuthStatusProvider(Func<IServiceProvider, IAuthStatusProvider>)

Configures a custom authentication status provider for the application.

public HtmxComponentOptions WithAuthStatusProvider(Func<IServiceProvider, IAuthStatusProvider> factory)

Parameters

factory Func<IServiceProvider, IAuthStatusProvider>

A factory function that creates the authentication status provider.

Returns

HtmxComponentOptions

The current options instance for method chaining.

WithAuthorizationRequirementFactory<T>()

Registers an authorization requirement factory implementation.

public void WithAuthorizationRequirementFactory<T>() where T : class, IAuthorizationRequirementFactory

Type Parameters

T

The type of the authorization requirement factory implementation.

Remarks

This method is required and must be called to register authorization support.

WithModelHandlerRegistry(Action<IModelRegistry, IServiceProvider>)

Configures the model handler registry with custom model configurations.

public HtmxComponentOptions WithModelHandlerRegistry(Action<IModelRegistry, IServiceProvider> configure)

Parameters

configure Action<IModelRegistry, IServiceProvider>

An action that configures the model registry with custom handlers.

Returns

HtmxComponentOptions

The current options instance for method chaining.

WithNavBuilder(Action<ActionSetBuilder>)

Configures navigation using a synchronous builder pattern.

public HtmxComponentOptions WithNavBuilder(Action<ActionSetBuilder> builderFactory)

Parameters

builderFactory Action<ActionSetBuilder>

An action that configures the navigation structure synchronously.

Returns

HtmxComponentOptions

The current options instance for method chaining.

WithNavBuilder(Func<ActionSetBuilder, Task>)

Configures navigation using an asynchronous builder pattern.

public HtmxComponentOptions WithNavBuilder(Func<ActionSetBuilder, Task> builderFactory)

Parameters

builderFactory Func<ActionSetBuilder, Task>

A function that configures the navigation structure asynchronously.

Returns

HtmxComponentOptions

The current options instance for method chaining.

WithResourceOperationRegistry<T>()

Registers a resource operation registry implementation.

public void WithResourceOperationRegistry<T>() where T : class, IResourceOperationRegistry

Type Parameters

T

The type of the resource operation registry implementation.

Remarks

This method is required and must be called to register authorization support.

WithRoleService<T>()

Registers a role service implementation for role-based authorization.

public HtmxComponentOptions WithRoleService<T>() where T : class, IRoleService

Returns

HtmxComponentOptions

The current options instance for method chaining.

Type Parameters

T

The type of the role service implementation.

WithUserIdClaimType(string)

Configures the claim type used to identify users in authorization caching.

public HtmxComponentOptions WithUserIdClaimType(string claimType)

Parameters

claimType string

The claim type to use for user identification. Defaults to NameIdentifier.

Returns

HtmxComponentOptions

The current options instance for method chaining.

WithViewOverrides(Action<ViewPaths>)

Configures custom view paths for component views.

public HtmxComponentOptions WithViewOverrides(Action<ViewPaths> configure)

Parameters

configure Action<ViewPaths>

An action that configures the view paths.

Returns

HtmxComponentOptions

The current options instance for method chaining.