(
+ ({
+ symbol,
+ language = 'tsx',
+ children,
+ // copyable = true,
+ type = 'ghost',
+ spotlight,
+ className,
+ ...props
+ }) => {
+ const { styles, cx } = useStyles(type);
+ return (
+
+ {/* {spotlight && } */}
+ {[symbol, children].filter(Boolean).join(' ')}
+ {/* {copyable && } */}
+
+ );
+ },
+);
+
+export { Snippet };
diff --git a/src/Snippet/style.ts b/src/Snippet/style.ts
new file mode 100644
index 00000000..54e67c0e
--- /dev/null
+++ b/src/Snippet/style.ts
@@ -0,0 +1,63 @@
+import { createStyles } from 'antd-style';
+
+export const useStyles = createStyles(({ css, cx, token, prefixCls }, type: 'ghost' | 'block') => {
+ const typeStylish = css`
+ background-color: ${type === 'block' ? token.colorFillTertiary : 'transparent'};
+ border: 1px solid ${type === 'block' ? 'transparent' : token.colorBorder};
+ `;
+
+ return {
+ container: cx(
+ typeStylish,
+ css`
+ position: relative;
+
+ overflow: hidden;
+ display: flex;
+ gap: 8px;
+ align-items: center;
+
+ max-width: 100%;
+ height: 38px;
+ padding: 0 8px 0 12px;
+
+ border-radius: ${token.borderRadius}px;
+
+ transition: background-color 100ms ${token.motionEaseOut};
+
+ &:hover {
+ background-color: ${token.colorFillTertiary};
+ }
+
+ .${prefixCls}-highlighter-shiki {
+ position: relative;
+ overflow: hidden;
+ flex: 1;
+ }
+
+ .prism-code {
+ background: none !important;
+ }
+
+ pre {
+ overflow-x: auto !important;
+ overflow-y: hidden !important;
+ display: flex;
+ align-items: center;
+
+ width: 100%;
+ height: 36px !important;
+ margin: 0 !important;
+
+ line-height: 1;
+
+ background: none !important;
+ }
+
+ code[class*='language-'] {
+ background: none !important;
+ }
+ `,
+ ),
+ };
+});
diff --git a/src/index.ts b/src/index.ts
index bc81c741..517b94c1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -27,6 +27,7 @@ export type { CanvasInteractRule, InteractStatus, InteractStatusNode } from './I
export { default as LevaPanel } from './LevaPanel';
export type { LevaPanelProps } from './LevaPanel';
export * from './ProBuilder';
+export * from './Snippet';
export * from './SortableList';
export * from './SortableTree';
export { default as TipGuide } from './TipGuide';