CustomTabOptionsBuilder¶
Fluent builder for constructing CustomTabOptions instances with runtime feature gating.
Overview¶
CustomTabOptionsBuilder provides a chainable API for configuring CustomTabOptions.
Each With* method returns the same builder instance for fluent chaining.
Call Build() to create the final CustomTabOptions object.
Example¶
var options = new CustomTabOptionsBuilder()
.WithColorScheme(ColorScheme.Dark)
.WithTitleShowed(true)
.WithUrlHidingEnabled(true)
.Build();
_customTab.LaunchUrlWithSession("https://example.com", options);
Methods¶
WithTitleShowed¶
Sets whether the page title is shown in the toolbar.
Parameters
titleShowed(bool):trueto show the page title; otherwisefalse.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithShareState¶
Sets share button visibility.
Parameters
shareState(ShareState): The desired share state.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithUrlHidingEnabled¶
Sets whether the URL bar hides while scrolling.
Parameters
urlHidingEnabled(bool):trueto hide the URL bar.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithBackgroundInteractionEnabled¶
public CustomTabOptionsBuilder WithBackgroundInteractionEnabled(
bool backgroundInteractionEnabled
)
Sets whether interaction with the app behind the tab is allowed in partial mode.
Parameters
backgroundInteractionEnabled(bool):trueto allow background interaction.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithBookmarksButtonEnabled¶
Sets whether the bookmarks button is shown.
Parameters
bookmarksButtonEnabled(bool):trueto show the bookmarks button.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithDownloadButtonEnabled¶
Sets whether the download button is shown.
Parameters
downloadButtonEnabled(bool):trueto show the download button.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithEphemeralBrowsingEnabled¶
Sets whether ephemeral browsing is enabled.
Parameters
ephemeralBrowsingEnabled(bool):trueto enable ephemeral browsing.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithColorScheme¶
Sets the color scheme for the Custom Tab.
Parameters
colorScheme(ColorScheme): The desired color scheme.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithLightColorSchemeOptions¶
public CustomTabOptionsBuilder WithLightColorSchemeOptions(
ColorSchemeOptions lightCustomTabColorSchemeOptions
)
Sets color options used in light mode.
Parameters
lightCustomTabColorSchemeOptions(ColorSchemeOptions): Light mode color options.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithDarkColorSchemeOptions¶
public CustomTabOptionsBuilder WithDarkColorSchemeOptions(
ColorSchemeOptions darkCustomTabColorSchemeOptions
)
Sets color options used in dark mode.
Parameters
darkCustomTabColorSchemeOptions(ColorSchemeOptions): Dark mode color options.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithDefaultColorSchemeOptions¶
public CustomTabOptionsBuilder WithDefaultColorSchemeOptions(
ColorSchemeOptions defaultCustomTabColorSchemeOptions
)
Sets fallback color options used when mode-specific options are not applied.
Parameters
defaultCustomTabColorSchemeOptions(ColorSchemeOptions): Fallback color options.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithInitialHeightPx¶
Sets the initial height in pixels for bottom-sheet mode.
Parameters
initialHeightPx(int): Initial height in pixels.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithInitialWidthPx¶
Sets the initial width in pixels for side-sheet mode.
Parameters
initialWidthPx(int): Initial width in pixels.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithHeightResizeBehavior¶
public CustomTabOptionsBuilder WithHeightResizeBehavior(
HeightResizeBehavior heightResizeBehavior
)
Sets resize behavior for bottom-sheet mode.
Parameters
heightResizeBehavior(HeightResizeBehavior): The desired resize behavior.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithToolbarCornerRadiusDp¶
Sets toolbar corner radius in density-independent pixels (dp) for bottom-sheet mode.
Parameters
toolbarCornerRadiusDp(int): Corner radius in dp. Maximum supported value is16.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithOpenAnimation¶
Sets the animation used when opening the tab.
Parameters
openAnimation(CustomTabAnimation): Animation pair for open transition.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithCloseAnimation¶
Sets the animation used when closing the tab.
Parameters
closeAnimation(CustomTabAnimation): Animation pair for close transition.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithShareIdentityEnabled¶
Sets whether app-specific history sharing is enabled.
Parameters
shareIdentityEnabled(bool):trueto enable app-specific history.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithSendToExternalDefaultHandlerEnabled¶
public CustomTabOptionsBuilder WithSendToExternalDefaultHandlerEnabled(
bool sendToExternalDefaultHandlerEnabled
)
Sets whether matching URLs are routed to external default handlers.
Parameters
sendToExternalDefaultHandlerEnabled(bool):trueto route matching URLs to external apps.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithSideSheetBreakingPointDp¶
Sets the screen width breakpoint in dp for switching to side-sheet mode.
Parameters
sideSheetBreakingPointDp(int): Breakpoint width in dp.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithSideSheetDecorationType¶
public CustomTabOptionsBuilder WithSideSheetDecorationType(
SideSheetDecoration sideSheetDecoration
)
Sets side-sheet decoration style.
Parameters
sideSheetDecoration(SideSheetDecoration): The desired decoration style.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithSideSheetMaximizationEnabled¶
public CustomTabOptionsBuilder WithSideSheetMaximizationEnabled(
bool sideSheetMaximizationEnabled
)
Sets whether side-sheet maximization is enabled.
Parameters
sideSheetMaximizationEnabled(bool):trueto allow maximization.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithSideSheetPosition¶
Sets side-sheet position.
Parameters
sideSheetPosition(SideSheetPosition): The desired side-sheet position.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithSideSheetRoundedCornersPosition¶
public CustomTabOptionsBuilder WithSideSheetRoundedCornersPosition(
SideSheetRoundedCornersPosition sheetRoundedCornersPosition
)
Sets which side-sheet corners are rounded.
Parameters
sheetRoundedCornersPosition(SideSheetRoundedCornersPosition): Rounded corner position rule.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithCloseButtonPosition¶
Sets close button position.
Parameters
closeButtonPosition(CloseButtonPosition): The desired close button position.
Returns
- The current
CustomTabOptionsBuilderinstance.
WithCloseButtonIcon¶
Sets close button icon style.
Parameters
closeButtonIcon(CloseButtonIcon): The desired close button icon.
Returns
- The current
CustomTabOptionsBuilderinstance.
Build¶
Builds and returns a CustomTabOptions instance from the current builder state.
Returns
- A new
CustomTabOptionsobject with all configured properties. - Unset properties remain
null.