1"use strict";(self.webpackChunkdocs=self.webpackChunkdocs||[]).push([[5264],{91711:(e,t,i)=>{i.r(t),i.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>a,frontMatter:()=>s,metadata:()=>d,toc:()=>c});var n=i(85893),r=i(11151);const s={sidebar_position:30,description:"Fit content to specified width.",toc_max_heading_level:2},o="fit-to-width",d={id:"reference/utils/fit-to-width",title:"fit-to-width",description:"Fit content to specified width.",source:"@site/docs/reference/utils/fit-to-width.mdx",sourceDirName:"reference/utils",slug:"/reference/utils/fit-to-width",permalink:"/docs/reference/utils/fit-to-width",draft:!1,unlisted:!1,tags:[],version:"current",sidebarPosition:30,frontMatter:{sidebar_position:30,description:"Fit content to specified width.",toc_max_heading_level:2},sidebar:"tutorialSidebar",previous:{title:"fit-to-height",permalink:"/docs/reference/utils/fit-to-height"},next:{title:"is-block",permalink:"/docs/reference/utils/is-block"}},l={},c=[{value:"width : <TypeLink></TypeLink> | <TypeLink></TypeLink> | <TypeLink></TypeLink> <Default><code>1fr</code></Default>",id:"width",level:3},{value:"grow : <TypeLink></TypeLink> <Default><code>true</code></Default>",id:"grow",level:3},{value:"shrink : <TypeLink></TypeLink> <Default><code>true</code></Default>",id:"shrink",level:3},{value:"body : <TypeLink></TypeLink>",id:"body",level:3},{value:"..args : <TypeLink></TypeLink>",id:"args",level:3}];function h(e){const t={a:"a",code:"code",h1:"h1",h3:"h3",p:"p",strong:"strong",...(0,r.a)(),...e.components},{Default:i,Param:s,Parameters:o,Signature:d,SignatureName:l,SignatureParam:c,SourceLink:h,TypeLink:a}=t;return i||u("Default",!0),s||u("Param",!0),o||u("Parameters",!0),d||u("Signature",!0),l||u("SignatureName",!0),c||u("SignatureParam",!0),h||u("SourceLink",!0),a||u("TypeLink",!0),(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(t.h1,{id:"fit-to-width",children:"fit-to-width"}),"\n",(0,n.jsx)(d,{children:(0,n.jsxs)("code",{children:[(0,n.jsx)(l,{children:"fit-to-width"}),"(",(0,n.jsxs)(c,{children:[(0,n.jsx)(t.a,{href:"#width",children:"width: 1fr"}),", "]}),(0,n.jsxs)(c,{children:[(0,n.jsx)(t.a,{href:"#grow",children:"grow: true"}),", "]}),(0,n.jsxs)(c,{children:[(0,n.jsx)(t.a,{href:"#shrink",children:"shrink: true"}),", "]}),(0,n.jsxs)(c,{children:[(0,n.jsx)(t.a,{href:"#body",children:"body"}),", "]}),(0,n.jsx)(c,{children:(0,n.jsx)(t.a,{href:"#args",children:"..args"})}),")",(0,n.jsx)(h,{href:"https://github.com/touying-typ/touying/blob/main/src/utils.typ#L1212"})]})}),"\n",(0,n.jsx)(t.p,{children:"Fit content to specified width."}),"\n",(0,n.jsxs)(t.p,{children:["Example: ",(0,n.jsx)(t.code,{children:"#utils.fit-to-width(100%)[BIG]"})]}),"\n",(0,n.jsxs)(o,{children:[(0,n.jsxs)(t.h3,{id:"width",children:["width : ",(0,n.jsx)(a,{type:"length"})," | ",(0,n.jsx)(a,{type:"fraction"})," | ",(0,n.jsx)(a,{type:"relative"})," ",(0,n.jsx)(i,{children:(0,n.jsx)(t.code,{children:"1fr"})})]}),(0,n.jsx)(s,{children:(0,n.jsxs)(t.p,{children:["The width to fit the content to. For example, ",(0,n.jsx)(t.code,{children:"width: 50%"})," will fit the content to half of the slide width. If given as a fraction, it will be based on the available width after everything else is evaluated, similar to how fractional lengths behave for table column widths. Default is ",(0,n.jsx)(t.code,{children:"1fr"})," which means to fit the content to the full available rest width."]})}),(0,n.jsxs)(t.h3,{id:"grow",children:["grow : ",(0,n.jsx)(a,{type:"bool"})," ",(0,n.jsx)(i,{children:(0,n.jsx)(t.code,{children:"true"})})]}),(0,n.jsx)(s,{children:(0,n.jsxs)(t.p,{children:["Indicates whether the content should be scaled up if it is smaller than the available width. Default is ",(0,n.jsx)(t.code,{children:"true"}),"."]})}),(0,n.jsxs)(t.h3,{id:"shrink",children:["shrink : ",(0,n.jsx)(a,{type:"bool"})," ",(0,n.jsx)(i,{children:(0,n.jsx)(t.code,{children:"true"})})]}),(0,n.jsx)(s,{children:(0,n.jsxs)(t.p,{children:["Indicates whether the content should be scaled down if it is larger than the available width. Default is ",(0,n.jsx)(t.code,{children:"true"}),"."]})}),(0,n.jsxs)(t.h3,{id:"body",children:["body : ",(0,n.jsx)(a,{type:"content"})]}),(0,n.jsx)(s,{children:(0,n.jsx)(t.p,{children:"The content to fit. If two positional arguments are given, this will be width instead."})}),(0,n.jsxs)(t.h3,{id:"args",children:["..args : ",(0,n.jsx)(a,{type:"arguments"})]}),(0,n.jsx)(s,{children:(0,n.jsx)(t.p,{children:"For convenience and compatibility with older versions, passing in width as a positional argument is still supported. If two positional arguments are given, the first one is the width and the second one is the body."})})]}),"\n",(0,n.jsxs)(t.p,{children:[(0,n.jsx)(t.strong,{children:"Returns:"})," ",(0,n.jsx)(a,{type:"content"})]})]})}function a(e={}){const{wrapper:t}={...(0,r.a)(),...e.components};return t?(0,n.jsx)(t,{...e,children:(0,n.jsx)(h,{...e})}):h(e)}function u(e,t){throw new Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}},11151:(e,t,i)=>{i.d(t,{Z:()=>d,a:()=>o});var n=i(67294);const r={},s=n.createContext(r);function o(e){const t=n.useContext(s);return n.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function d(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:o(e.components),n.createElement(s.Provider,{value:t},e.children)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.