Skip to content

Add HAFloatingActionButton component#7204

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

Add HAFloatingActionButton component#7204
hdcodedev wants to merge 6 commits 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
@hdcodedev
hdcodedev requested a review from jpelgrom July 21, 2026 10:50

@TimoPtr TimoPtr left a comment

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.

Small changes and we are ready to go. As for UI feedback for now we don't have, so let's go with the default and use the custom component so that we can change everywhere in one shot when needed.

contentColor = colors.contentColor,
content = {
Icon(
imageVector = icon,

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 wonder if you should actually use the contentColor there? no or M3 is already handling this properly

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.

It is needed because we are using variants. If we want this one to be primary only, then we could probably drop the explicit colors.

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.

The imageVector is tint with the contentColor?

@home-assistant
home-assistant Bot marked this pull request as draft July 21, 2026 11:02
@home-assistant

Copy link
Copy Markdown

Please take a look at the requested changes, and use the Ready for review button when you are done, thanks 👍

Learn more about our pull request process.

hdcodedev and others added 3 commits July 21, 2026 13:14
Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com>
Co-authored-by: Timothy <6560631+TimoPtr@users.noreply.github.com>
@hdcodedev
hdcodedev marked this pull request as ready for review July 21, 2026 11:49
@home-assistant
home-assistant Bot requested a review from TimoPtr July 21, 2026 11:49
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.

4 participants