Components
Buttons providing easy access to important actions.
There are two floating action button components: TextFloatingActionButton and IconFloatingActionButton.
TextFloatingActionButton is used to display text and includes an option to add a UIView to the left of it.
IconFloatingActionButton is an icon or image only floating action button.
There are two standard fab themes on iOS. In addition, custom themes can be defined by calling the TextFloatingActionButton.Theme and IconFloatingActionButton.Theme constructors directly.


![]()
![]()
public let backgroundColor: UIColorpublic let borderColor: UIColorpublic let tintColor: UIColorpublic let highlightedBackgroundColor: UIColorpublic let highlightedBorderColor: UIColorpublic let height: CGFloatpublic let horizontalPadding: CGFloatpublic let iconTextSpacing: CGFloatpublic let textStyle: Font.TextStylepublic let shadowImage: UIImage?public init(backgroundColor: UIColor, borderColor: UIColor, tintColor: UIColor, highlightedBackgroundColor: UIColor, highlightedBorderColor: UIColor, textStyle: Font.TextStyle = .title6, shadowImage: UIImage? = UIImage(named: "textFabShadow", in: Bundle.thumbprint, compatibleWith: nil), height: CGFloat = 44, horizontalPadding: CGFloat = Space.three, iconTextSpacing: CGFloat = Space.two)public static let primary: TextFloatingActionButton.ThemePrimary text fab theme.
public static let secondary: TextFloatingActionButton.ThemeSecondary text fab theme.
public let backgroundColor: UIColorpublic let borderColor: UIColorpublic let tintColor: UIColorpublic let highlightedBackgroundColor: UIColorlet highlightedBorderColor: UIColorpublic init(backgroundColor: UIColor, borderColor: UIColor, tintColor: UIColor, highlightedBackgroundColor: UIColor, highlightedBorderColor: UIColor)public static let primary: IconFloatingActionButton.ThemePrimary icon fab theme.
public static let secondary: IconFloatingActionButton.ThemeSecondary icon fab theme.
public private(set) var text: String?The text displayed. This is a read-only variable. See func setText for setting the text.
public func setText(_ text: String?, accessibilityLabel: String)Use this function to set the fab’s displayed (text) and read-out accessibility (accessibilityLabel) texts.
public private(set) var leftView: UIView?This is the view set on the left of the displayed text. This is a read-only variable. See func setLeftView for setting the view.
public func setLeftView(_ view: UIView, largeContentImage: UIImage?)Use this function to set the left view (view) and the image shown when holding the image while using an accessibility text size (largeContentImage).
public var theme: Themepublic override var isHighlighted: Boolpublic init(text: String, accessibilityLabel: String, theme: TextFloatingActionButton.Theme = .primary)public override var intrinsicContentSize: CGSizepublic private(set) var icon: UIImage?This is the displayed icon for the fab. This is a read-only variable. See func setIcon for setting the icon.
public func setIcon(_ icon: UIImage, accessibilityLabel: String)Use this function to set the icon (icon) and the read-out accessibility label (accessibilityLabel) for the icon fab.
public var theme: Themepublic override var isHighlighted: Boolpublic init(icon: UIImage, accessibilityLabel: String, theme: IconFloatingActionButton.Theme = .primary)public override var intrinsicContentSize: CGSize