Skip to main content
Member storefront is in a limited pilot. Confirm that member storefront is enabled for your company before you add the Passport to a theme.
The Passport is the member’s account menu: their account, orders, subscriptions and sign-out, in one panel, with their Sites when you turn them on. On your storefront’s theme pages, one <fluid-passport> tag draws it. This page covers where it shows and how you open it from your theme. On a Site, the storefront draws and places the Passport for you. A Site opens it with fluid.auth.openPassport(). See Passport and sign-in.

Add the Passport

The member storefront SDK script that Fluid adds to your storefront also defines the Passport, so your theme adds only the tag. A storefront that still loads the older member storefront SDK script doesn’t define it, and the tag draws nothing there. Ask Fluid support to move your storefront to the current script. Put the tag once in layouts/theme.liquid, just before </body>:
layouts/theme.liquid
With no attributes, the Passport is a 60px round button, 40px from the right edge and 98px from the bottom of the screen. A signed-in member sees their avatar on it, and a click opens the panel. A guest sees a Sign in link in the same spot instead.
  • One tag per page. Only the first Passport on a page answers your buttons and scripts. A second one logs a console warning.
  • It replaces the theme’s account menu. While a Passport is on the page, it hides every {% member_account %} menu, so a member never sees two. A Passport with placement="off" hides nothing. See Add an account menu.
  • Don’t load the script yourself. A second copy of the script doesn’t take over the first one’s Passport.

Choose where it shows

The placement attribute sets how the Passport shows: Every attribute on this page also works with a data- prefix, such as data-placement. When a tag has both, the prefixed one wins. An unknown value falls back to the default.

Float it in a corner

A floating Passport takes these attributes: For example, to put a smaller button in the bottom-left corner, clear of a chat button on the right:
The panel opens from the button toward the middle of the screen. From a bottom corner it opens above the button, and from a top corner it opens below it, unless there’s little room there. See How it stays in view.

Let the member choose the spot

When your tag sets no position, the Passport’s list ends with a Passport settings row. There the member puts the button at the bottom left, center or right of the screen. The browser remembers their choice. When the browser blocks storage, the choice lasts until they leave the page. Set position to one of the four corners to keep the button where you put it. Your corner wins, and the member then sees no Passport settings row. An inline, none or off Passport has no row either. Only the member can choose the center. The Passport doesn’t read bottom_center or any other value it doesn’t know, so that tag counts as setting no position, and the member chooses.

Put it in your header

To draw the button in your own layout, set placement="inline" and put the tag where the button goes:
An inline button is 40px unless you set size. Its panel, up to 360px wide, opens beside the button, on the side of the screen with more room. A guest sees the Sign in link where the button would be.

Open it only from your own buttons

To draw no Passport button at all, set placement="none" and give your own account button a data-fluid-passport-open attribute:
Your button stays the way in, so the Passport checks for it:
  • One second after the page loads, if no visible element has data-fluid-passport-open and nothing has opened the Passport, it falls back to floating: its own button in the corner, or Sign in for a guest. It stays floating for as long as it’s on the page.
  • Visible means drawn. An opener counts unless it’s off the page, hidden by CSS (display: none or visibility: hidden), fully transparent, or has no size. The check doesn’t look at where it is, so an opener moved off screen, such as in a closed drawer, still counts, and no fallback shows. Keep at least one opener on screen.
  • Use the attribute, not a click handler. The check looks for data-fluid-passport-open, so a button that calls fluid.passport.open() from its own click handler doesn’t stop the fallback.
  • Show the opener to guests too. A guest who clicks it is sent to sign in. If you hide it from guests, the fallback adds its own Sign in link next to yours.

Show the member’s Sites

The Passport lists the member’s Sites only when the tag has the site-menu attribute:
With it, a signed-in member’s Passport shows their Sites and the Sites room. Without it, there’s no Sites section, and the sites room opens the list instead.

Turn it off

placement="off" also makes no request for the member’s session. Member prices and the rest of the member storefront SDK keep working, because off turns off only the menu.

How it stays in view

In a browser with popovers, the Passport places its panel inside the part of the screen the visitor can see, in every placement:
  • It keeps 16px from every edge of what shows: inside the page’s scrollbars, above a phone’s or tablet’s on-screen keyboard, and within a pinch zoom.
  • It opens where there’s room. A panel that would get under 160px on its side opens on the other side when that side has more room.
  • Its height fits the space left. The panel is never taller than the room it has, and its content scrolls inside. In a very short window it keeps 160px, or all of what shows when that’s less, so none of it goes off screen.
  • It moves with the screen. The panel is placed again when the window resizes, including a rotation or a zoom, when the page scrolls, and when the keyboard opens or closes.
You don’t set any of this, and your theme can’t turn it off. A browser without popovers places a floating panel from its corner with the stylesheet alone, so it doesn’t flip or follow the keyboard.

How it behaves on phones

On a phone, the panel is a bottom sheet in every placement. The sheet takes the full width along the bottom of the screen, over a dimmed page, clear of the home indicator. A phone here means a screen narrower than 640px, or a touch screen under 500px tall, such as a phone held sideways. With the keyboard up, the sheet stands on top of the keyboard and is never taller than what shows. The sheet covers the Passport’s button, so it has its own close button at the top. A tap on the dimmed page closes it too. You don’t need a separate phone layout for it: an inline button in your header opens the same sheet.

Over your theme’s layers

The open panel, and the phone sheet with its dimmed page, are drawn in the browser’s top layer, as a popover, in every placement. Nothing your theme stacks covers or clips it: not a header’s overflow: hidden, a z-index, a transform, a filter or contain. You don’t need to raise anything to keep it on top.
  • The button uses z-index. A floating button sits at z-index: 2147483000. Set the z-index attribute to put something of your own, such as a chat button, above or below it.
  • Older browsers keep the panel in the page. A browser without popovers draws the panel at the Passport’s z-index instead. There, an ancestor of the tag that has its own stacking context, such as a positioned ancestor with a z-index, holds the panel at that ancestor’s level. So does an ancestor with a transform, filter, backdrop-filter, will-change: transform or contain: paint. Keep an inline tag out of such an ancestor if you support those browsers.
  • A modal <dialog> blocks it. Your theme’s own modal dialog makes the rest of the page inert, the Passport included. Close the dialog before you open the Passport.
  • A click outside closes it. That click doesn’t also reach the link or button under it. Escape closes it too, and focus goes back to what opened it.

Open it from your theme

You can open the Passport from a button or link, from a script, or with an event. Each one can name the room to open on. With a floating or inline Passport, the panel always opens from the Passport’s own button. With placement="none", it opens beside the element that opened it.

Rooms

A room is one part of the member’s account, opened inside the panel: Any other value opens the list. A click on any element with data-fluid-passport-open opens the Passport, or closes it when it’s open. The attribute’s value, if any, names the room:
The opener can be a link too. A link keeps its href for a page without the Passport. On a page with one, the click opens the Passport instead of following the link.
  • With placement="none", a click on a different opener while the panel is open moves it beside that opener and to that opener’s room. A click on the opener it’s open for closes it.
  • With floating or inline, a click on a different opener moves a panel that an opener opened to that opener’s room, and the panel stays at the Passport’s button. A panel the member opened from the Passport’s own button closes on a click on any opener.
  • While the panel is open, every opener has aria-expanded="true", and "false" once it closes. When it closes, focus goes back to the opener that opened it.
  • With placement="none", if the opener that opened it leaves the page, the panel moves to the next visible opener, or closes when there’s none.

From a script

The script adds fluid.passport to the page, next to anything else already on window.fluid:
  • open and toggle take room, a room from the table above, and anchor, the element focus returns to on close. With placement="none", the panel also opens beside anchor, unless it’s hidden.
  • Without an anchor, a placement="none" panel opens beside the first visible data-fluid-passport-open element, or from the corner position names when there’s none.
  • toggle closes an open panel, whatever room or anchor it names.
  • For a guest, open and toggle send the visitor to sign in instead.
  • A call made before the Passport knows who’s signed in is carried out once it does. A close, or a second toggle, made before then cancels it.
  • isOpen is read-only, and so is fluid.passport. Don’t assign it.

Before the script loads

The member storefront SDK loads as a module script, after your theme’s own inline scripts have run. To call fluid.passport from a script that may run first, put this stub before it:
Then call fluid.passport as usual. When the script loads, it replaces the stub and replays the queued calls in order, once a Passport is on the page.

With events

You can also dispatch an event on window, with the same room and anchor in detail:
The Passport fires fluid-passport:opened and fluid-passport:closed, which bubble to window, with the room in detail.room:
The element itself also has open() and toggle(), which take the same options, and an isOpen property. They work on any <fluid-passport>, not only the first one on the page. To close it, use fluid.passport.close() or the close event, which put focus back on what opened it.

From a Site or a Mist page

A Site runs in its own frame, so it can’t add the tag, call fluid.passport or use data-fluid-passport-open. It opens the Passport from a click with fluid.auth.openPassport(), and so does a Site you build in Mist. See Open the Passport from your own button.

What not to do

  • Don’t load the script a second time, or pin another version of it. See Add the Passport.
  • Don’t add a second <fluid-passport>. Only the first answers your openers, scripts and events.
  • Don’t set position="bottom_center". The member then chooses the spot. See Let the member choose the spot.
  • Don’t open a placement="none" Passport from a click handler, and don’t hide its opener from guests. See Open it only from your own buttons.
  • Don’t assign fluid.passport. Use the stub, which keeps an API that’s already there.

For agents

To put the Passport’s button in a theme’s header, and add a button elsewhere that opens it on orders:
Then check:
  1. The page has exactly one <fluid-passport> and loads the member storefront SDK script once.
  2. The theme doesn’t also show a {% member_account %} menu where the Passport should be.
  3. Signed in, a click opens the panel, and Escape closes it and puts focus back.
  4. Signed out, the visitor sees Sign in, and an opener sends them to sign in.
  5. At a phone width, under 640px, the panel opens as a bottom sheet with its own close button.
  6. In a short window, and on a phone with the keyboard up, all of the panel stays on screen and its content scrolls.
  7. With placement="none", the theme’s opener is visible to guests and members, and no corner button shows up a second after load.
On a Site, call fluid.auth.openPassport() from a click instead, and check it on the published Site. See Passport and sign-in.