1

I'm using Fluent UI's TeachingBubble component. I want it to have one button, which should be centered. How can that be done? I'm unable to move it from the bottom right corner.

Current code:

      <TeachingBubble
        headline="Welcome"
        primaryButtonProps={{
          children: "Next",
          onClick: () => alert("Primary button pressed!"),
        }}
      >
        This is some content.
      </TeachingBubble>

This outputs:

enter image description here

What should be added to this code so that the primary button is centered (at the red cross I marked)?

Alcibiades
  • 335
  • 5
  • 16

1 Answers1

1

Button is inside footer part of TeachingBubble, so the style of footer should be changed:

<TeachingBubble
        headline="Welcome"
        primaryButtonProps={{
          children: "Next",
          onClick: () => alert("Primary button pressed!"),
        }}
        styles={{
          footer: {
            display: "flex",
            justifyContent: "center",
          },
        }}
      >
        Some text
      </TeachingBubble>

That renders as:

enter image description here

Alcibiades
  • 335
  • 5
  • 16