Even collapsed, the <nav> landmark and its links must stay in the DOM — when label text visually disappears, each link still needs an accessible name via aria-label or title so a screen reader user doesn't lose the item. The toggle button carries aria-expanded and aria-controls to announce its state and what it operates.
The difference from a navigation rail (see that entry) is whether it transitions at all — a rail is a separate component, fixed at an icon-only narrow width from the start, while a collapsible sidebar is one panel that toggles between a "wide, labeled" state and a "narrow, icon-only" state. The collapsed look can end up resembling a rail, but one is fixed and the other is toggleable. It's also unlike a hamburger menu and drawer — those hide a panel completely off-screen on mobile and bring it back, while a collapsible sidebar on desktop never disappears, only narrows.
Transitioning the width smoothly avoids the layout feeling like it jumps when the state changes.