Skip to main content

euv_ui/component/space/view/
impl.rs

1use super::*;
2
3/// Inherent implementation of [`EuvSpaceSize`].
4impl EuvSpaceSize {
5    /// Returns the name of the design token backing this step.
6    ///
7    /// The returned name is the token key without the `--` prefix, ready to be
8    /// passed to [`var!`]; the caller resolves it to a `var(--token)`
9    /// reference rather than hardcoding a pixel value.
10    ///
11    /// # Returns
12    ///
13    /// - `&'static str` - The design token name: `space-xs`, `space-sm`,
14    ///   `space-md`, `space-lg`, or `space-xl`.
15    pub fn token(&self) -> &'static str {
16        match self {
17            EuvSpaceSize::Xs => "space-xs",
18            EuvSpaceSize::Sm => "space-sm",
19            EuvSpaceSize::Md => "space-md",
20            EuvSpaceSize::Lg => "space-lg",
21            EuvSpaceSize::Xl => "space-xl",
22        }
23    }
24}