Tooltip
A tooltip gives a short hint about a control. Keep the action itself clearly named so the hint can add detail without carrying the instruction on its own.
Explain a bookmark
#Hover over Bookmark to reveal what saving the bookmark does. Try focusing it from the keyboard too. Activate the button to add the file, then activate it again to remove it.
components/tooltip/appliance/bookmark_hint.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class BookmarkHint extends StatefulWidget {
const BookmarkHint({super.key});
@override
State<BookmarkHint> createState() => _BookmarkHintState();
}
class _BookmarkHintState extends State<BookmarkHint> {
bool saved = false;
@override
Widget build(BuildContext context) => ApplianceTooltip(
message: saved ? 'Remove from Saved files' : 'Keep in Saved files',
child: ApplianceButton(
saved ? 'Remove bookmark' : 'Bookmark',
onPressed: () => setState(() => saved = !saved),
),
);
}
Parameters
ApplianceTooltip API ↗message- Hint for the button in its current state.
child- The control that owns the hint.
Shared behaviour
- Keyboard and focus. Tab to the button to try its focus hint. Enter or Space toggles the bookmark.
- Screen readers. The button has a visible action name. Read its hint and the changed name after activation.
- Direction and type. The hint follows its anchor. Compare the available space around the button in RTL and at 200% text.