Skip to content

Add HAFloatingActionButton component#7204

Open
hdcodedev wants to merge 1 commit into
home-assistant:mainfrom
hdcodedev:feature/ha-floating-action-button
Open

Add HAFloatingActionButton component#7204
hdcodedev wants to merge 1 commit into
home-assistant:mainfrom
hdcodedev:feature/ha-floating-action-button

Conversation

@hdcodedev

Copy link
Copy Markdown
Contributor

Summary

As part of the Shortcuts V2 work we're building, we added a reusable HAFloatingActionButton component so it can be shared across features.

Checklist

  • New or updated tests have been added to cover the changes following the testing guidelines.
  • The code follows the project's code style and best_practices.
  • The changes have been thoroughly tested, and edge cases have been considered.
  • Changes are backward compatible whenever feasible. Any breaking changes are documented in the changelog for users and/or in the code for developers depending on the relevance.

Screenshots

Link to pull request in documentation repositories

User Documentation: home-assistant/companion.home-assistant#

Developer Documentation: home-assistant/developers.home-assistant#

Any other notes

@hdcodedev hdcodedev changed the title feat(compose): add HAFloatingActionButton component Add HAFloatingActionButton component Jul 17, 2026
@hdcodedev
hdcodedev marked this pull request as ready for review July 17, 2026 17:49
Copilot AI review requested due to automatic review settings July 17, 2026 17:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a reusable HAFloatingActionButton Compose component in :common so features (e.g., Shortcuts V2) can share a Home Assistant–themed FAB implementation and validate its visuals via screenshot tests.

Changes:

  • Added HAFloatingActionButton component with ButtonVariant-driven color theming via LocalHAColorScheme.
  • Added a light/dark screenshot test that renders the FAB across all ButtonVariant values.
  • Included a preview for quick local inspection of the component.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
common/src/main/kotlin/io/homeassistant/companion/android/common/compose/composable/HAFloatingActionButton.kt Adds the new HA-themed FAB composable + preview.
common/src/screenshotTest/kotlin/io/homeassistant/companion/android/compose/composable/HAFloatingActionButtonScreenshotTest.kt Adds screenshot coverage for the FAB across variants in light/dark.

@hdcodedev
hdcodedev force-pushed the feature/ha-floating-action-button branch from 66a1fcf to 7b71946 Compare July 17, 2026 18:03
onClick: () -> Unit,
contentDescription: String?,
modifier: Modifier = Modifier,
variant: ButtonVariant = ButtonVariant.PRIMARY,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should not have all variants for this one, but just follow what other components do. If we want to keep it primary only, I can make an update.

FloatingActionButton(
onClick = onClick,
modifier = modifier.size(ButtonSize.LARGE.value),
shape = CircleShape,

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm hardcoding this one for consistency. If we give too much freedom, it might end up inconsistent across multiple features. Still, if we think it's worth moving up, we can do that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there is room for some discussion on what the FAB shape should be. M3 default is square with rounded corners, not a circle. I don't know if the HA product design team has any plans with this, @TimoPtr can you ask?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants