Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !31641

Revamp close button component

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Mark Otto requested to merge btn-close into main Sep 14, 2020
  • Overview 3
  • Commits 11
  • Pipelines 0
  • Changes 11

This PR redesigns our close buttons to make them more consistent across browsers and devices, as well as making it slightly easier to style them overall. With a little CSS background-image magic, we're sizing the × SVG to the content-box. This allows us to give use padding and rounded corners that carry the styling through with no impact to the × icon.

  • Renamed .close to .btn-close for more specific class name
  • Replaced inline × sign with embedded SVG in our CSS
  • Improved focus styles with custom box-shadow "outline" like our buttons
  • Increased focus shadow width of all buttons, including the new close button, from .2em to .25em for a more pixel perfect rendering
  • Adds .btn-close-white variant for darker backgrounds.

Here's a preview of the default and disabled styles, as well as a focused and disabled style.

Screen Shot 2020-09-13 at 7 12 22 PM Screen Shot 2020-09-13 at 7 12 29 PM Screen Shot 2020-09-13 at 7 47 56 PM

Closes #30927 and closes #31478.

Fixes #30917 (closed) (focus), fixes #28787 (closed) (default styling in toasts), fixes #27294 (closed) (rename). and fixes #27163 (closed) (focus).

Preview: https://deploy-preview-31641--twbs-bootstrap.netlify.app/docs/5.0/components/close-button/

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: btn-close